Skip to content

Commit 88840eb

Browse files
committed
Merge remote-tracking branch 'refs/remotes/uber/main' into cmp_diff2
# Conflicts: # go.mod
2 parents 515001f + c9ae04c commit 88840eb

File tree

8 files changed

+33
-45
lines changed

8 files changed

+33
-45
lines changed

.github/dependabot.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "gomod"
4+
directory: "/tools"
5+
schedule:
6+
interval: "daily"
7+
open-pull-requests-limit: 5
8+
- package-ecosystem: "gomod"
9+
directory: "/mockgen/internal/tests/generics"
10+
schedule:
11+
interval: "daily"
12+
open-pull-requests-limit: 5
13+
- package-ecosystem: "gomod"
14+
directory: "/mockgen/internal/tests/typed"
15+
schedule:
16+
interval: "daily"
17+
open-pull-requests-limit: 5
18+
- package-ecosystem: "github-actions"
19+
directory: "/"
20+
schedule:
21+
interval: "weekly"

go.mod

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ go 1.20
44

55
require (
66
github.com/google/go-cmp v0.6.0
7-
golang.org/x/mod v0.11.0
8-
golang.org/x/tools v0.2.0
7+
golang.org/x/mod v0.15.0
8+
golang.org/x/tools v0.18.0
99
)
1010

11-
require (
12-
github.com/yuin/goldmark v1.4.13 // indirect
13-
golang.org/x/sys v0.1.0 // indirect
14-
)
11+
require github.com/yuin/goldmark v1.4.13 // indirect

go.sum

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
44
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
55
github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE=
66
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
7-
golang.org/x/mod v0.11.0 h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU=
8-
golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
9-
golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=
10-
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
11-
golang.org/x/tools v0.2.0 h1:G6AHpWxTMGY1KyEYoAQ5WTtIekUUvDNjan3ugu60JvE=
12-
golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA=
7+
golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8=
8+
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
9+
golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ=
10+
golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg=

gomock/call.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,7 @@ func (c *Call) SetArg(n int, value any) *Call {
256256
c.t.Fatalf("SetArg(%d, ...) argument is a %v, not assignable to %v [%s]",
257257
n, vt, dt, c.origin)
258258
}
259-
case reflect.Interface:
260-
// nothing to do
261-
case reflect.Slice:
262-
// nothing to do
263-
case reflect.Map:
259+
case reflect.Interface, reflect.Slice, reflect.Map:
264260
// nothing to do
265261
default:
266262
c.t.Fatalf("SetArg(%d, ...) referring to argument of non-pointer non-interface non-slice non-map type %v [%s]",

mockgen/generic.go

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"fmt"
1313
"go/ast"
1414
"go/token"
15-
"strings"
1615

1716
"go.uber.org/mock/mockgen/model"
1817
)
@@ -64,29 +63,6 @@ func (p *fileParser) parseGenericType(pkg string, typ ast.Expr, tps map[string]m
6463
return nil, nil
6564
}
6665

67-
func getIdentTypeParams(decl any) string {
68-
if decl == nil {
69-
return ""
70-
}
71-
ts, ok := decl.(*ast.TypeSpec)
72-
if !ok {
73-
return ""
74-
}
75-
if ts.TypeParams == nil || len(ts.TypeParams.List) == 0 {
76-
return ""
77-
}
78-
var sb strings.Builder
79-
sb.WriteString("[")
80-
for i, v := range ts.TypeParams.List {
81-
if i != 0 {
82-
sb.WriteString(", ")
83-
}
84-
sb.WriteString(v.Names[0].Name)
85-
}
86-
sb.WriteString("]")
87-
return sb.String()
88-
}
89-
9066
func (p *fileParser) parseGenericMethod(field *ast.Field, it *namedInterface, iface *model.Interface, pkg string, tps map[string]model.Type) ([]*model.Method, error) {
9167
var indices []ast.Expr
9268
var typ ast.Expr

mockgen/mockgen.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ type generator struct {
256256
}
257257

258258
func (g *generator) p(format string, args ...any) {
259-
fmt.Fprintf(&g.buf, g.indent+format+"\n", args...)
259+
_, _ = fmt.Fprintf(&g.buf, g.indent+format+"\n", args...)
260260
}
261261

262262
func (g *generator) in() {

tools/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module github.com/uber-go/mock/tools
22

33
go 1.21
44

5-
require github.com/stretchr/testify v1.8.4
5+
require github.com/stretchr/testify v1.9.0
66

77
require (
88
github.com/davecgh/go-spew v1.1.1 // indirect

tools/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
22
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
33
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
44
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
5-
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
6-
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
5+
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
6+
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
77
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
88
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
99
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

0 commit comments

Comments
 (0)