Skip to content

Commit

Permalink
update deps (#15)
Browse files Browse the repository at this point in the history
* update direct deps

* update indirect deps
  • Loading branch information
MihailsKuzmins authored Oct 29, 2021
1 parent 8d224be commit be5bc58
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 23 deletions.
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ module github.com/MyNihongo/mockgen
go 1.17

require (
github.com/MyNihongo/codegen v0.0.17
github.com/MyNihongo/codegen v0.0.19
github.com/stretchr/testify v1.7.0
golang.org/x/tools v0.1.6
golang.org/x/tools v0.1.7
)

require (
github.com/davecgh/go-spew v1.1.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/mod v0.4.2 // indirect
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e // indirect
golang.org/x/mod v0.5.1 // indirect
golang.org/x/sys v0.0.0-20211029165221-6e7872819dc8 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)
20 changes: 12 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
github.com/MyNihongo/codegen v0.0.17 h1:pSyTDNBK/5+E9t92vHfItoeYHHWdJldvhsEzvT5mM0E=
github.com/MyNihongo/codegen v0.0.17/go.mod h1:1H+DDKXasO56+uZd9kdBZsZ08dVcGK/2uo6ZVqfw2Oc=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/MyNihongo/codegen v0.0.19 h1:DQJSJXFEHFvosAiHuqaqF5aY72e1jgVfmCBFNnf27fE=
github.com/MyNihongo/codegen v0.0.19/go.mod h1:1H+DDKXasO56+uZd9kdBZsZ08dVcGK/2uo6ZVqfw2Oc=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand All @@ -10,8 +11,9 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.5.1 h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38=
golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
Expand All @@ -21,20 +23,22 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e h1:WUoyKPm6nCo1BnNUvPGnFG3T5DUVem42yDJZZ4CNxMA=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211029165221-6e7872819dc8 h1:M69LAlWZCshgp0QSzyDcSsSIejIEeuaCVpmwcKwyLMk=
golang.org/x/sys v0.0.0-20211029165221-6e7872819dc8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.6 h1:SIasE1FVIQOWz2GEAHFOmoW7xchJcqlucjSULTL0Ag4=
golang.org/x/tools v0.1.6/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ=
golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
10 changes: 5 additions & 5 deletions internal/generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func GenerateMocks(wd, pkgName string, mocks []*MockDecl) (*gen.File, error) {
file.CommentF("%s creates a new fixture with all mocks", createFixtureName)
createFixtureFunc := file.Func(createFixtureName).ReturnTypes(
createFixtureReturnType(mock.mockNameDecl),
gen.ReturnType(fixtureName).Pointer(),
gen.Type(fixtureName).Pointer(),
)

initFixture := gen.InitStruct(mock.typeName).Address()
Expand Down Expand Up @@ -98,7 +98,7 @@ func generateMock(file *gen.File, field *FieldDecl, mockName string, methods []*

for _, method := range methods {
params := make([]*gen.ParamDecl, method.LenParams())
returns := make([]*gen.ReturnTypeDecl, method.LenReturns())
returns := make([]*gen.TypeDecl, method.LenReturns())

args := make([]gen.Value, method.LenParams())
returnValues := make([]gen.Value, method.LenReturns())
Expand All @@ -118,7 +118,7 @@ func generateMock(file *gen.File, field *FieldDecl, mockName string, methods []*
for i, returnType := range method.Returns() {
alias := addImportAlias(file, returnType.PkgImport())

returns[i] = gen.QualReturnType(
returns[i] = gen.QualType(
alias,
returnType.TypeName(),
).SetIsPointer(returnType.IsPointer())
Expand Down Expand Up @@ -205,7 +205,7 @@ func generateMethodSetup(file *gen.File, vals *methodValues) {
setupReturnsName := fmt.Sprintf("setup_%s_%s", vals.mockName, vals.method.Name())

methodSetup.ReturnTypes(
gen.ReturnType(setupReturnsName).Pointer(),
gen.Type(setupReturnsName).Pointer(),
)

callSetupStmt = gen.Declare(call).Values(callSetupValue)
Expand All @@ -227,7 +227,7 @@ func generateMethodSetup(file *gen.File, vals *methodValues) {
)
}

func generateMethodReturnSetup(file *gen.File, setupReturnsName string, returns []*gen.ReturnTypeDecl) {
func generateMethodReturnSetup(file *gen.File, setupReturnsName string, returns []*gen.TypeDecl) {
params := make([]*gen.ParamDecl, len(returns))
args := make([]gen.Value, len(returns))

Expand Down
2 changes: 1 addition & 1 deletion internal/generator/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type methodValues struct {
mockName string
params []*gen.ParamDecl
args []gen.Value
returns []*gen.ReturnTypeDecl
returns []*gen.TypeDecl
returnValues []gen.Value
}

Expand Down
6 changes: 3 additions & 3 deletions internal/generator/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ func createFixtureTypeName(mockName *mockNameDecl) string {
return fmt.Sprintf("fixture%s", strings.Title(name))
}

func createFixtureReturnType(mockName *mockNameDecl) *gen.ReturnTypeDecl {
func createFixtureReturnType(mockName *mockNameDecl) *gen.TypeDecl {
if len(mockName.interfaceName) != 0 {
return gen.ReturnType(mockName.interfaceName)
return gen.Type(mockName.interfaceName)
} else {
return gen.ReturnType(mockName.typeName).Pointer()
return gen.Type(mockName.typeName).Pointer()
}
}

Expand Down

0 comments on commit be5bc58

Please sign in to comment.