diff --git a/gomock/call.go b/gomock/call.go index e1ea826..ef76fd3 100644 --- a/gomock/call.go +++ b/gomock/call.go @@ -251,11 +251,7 @@ func (c *Call) SetArg(n int, value any) *Call { c.t.Fatalf("SetArg(%d, ...) argument is a %v, not assignable to %v [%s]", n, vt, dt, c.origin) } - case reflect.Interface: - // nothing to do - case reflect.Slice: - // nothing to do - case reflect.Map: + case reflect.Interface, reflect.Slice, reflect.Map: // nothing to do default: c.t.Fatalf("SetArg(%d, ...) referring to argument of non-pointer non-interface non-slice non-map type %v [%s]", diff --git a/mockgen/generic.go b/mockgen/generic.go index d425e77..c2289c2 100644 --- a/mockgen/generic.go +++ b/mockgen/generic.go @@ -12,7 +12,6 @@ import ( "fmt" "go/ast" "go/token" - "strings" "go.uber.org/mock/mockgen/model" ) @@ -64,29 +63,6 @@ func (p *fileParser) parseGenericType(pkg string, typ ast.Expr, tps map[string]m return nil, nil } -func getIdentTypeParams(decl any) string { - if decl == nil { - return "" - } - ts, ok := decl.(*ast.TypeSpec) - if !ok { - return "" - } - if ts.TypeParams == nil || len(ts.TypeParams.List) == 0 { - return "" - } - var sb strings.Builder - sb.WriteString("[") - for i, v := range ts.TypeParams.List { - if i != 0 { - sb.WriteString(", ") - } - sb.WriteString(v.Names[0].Name) - } - sb.WriteString("]") - return sb.String() -} - func (p *fileParser) parseGenericMethod(field *ast.Field, it *namedInterface, iface *model.Interface, pkg string, tps map[string]model.Type) ([]*model.Method, error) { var indices []ast.Expr var typ ast.Expr diff --git a/mockgen/mockgen.go b/mockgen/mockgen.go index cca4467..7fe3770 100644 --- a/mockgen/mockgen.go +++ b/mockgen/mockgen.go @@ -256,7 +256,7 @@ type generator struct { } func (g *generator) p(format string, args ...any) { - fmt.Fprintf(&g.buf, g.indent+format+"\n", args...) + _, _ = fmt.Fprintf(&g.buf, g.indent+format+"\n", args...) } func (g *generator) in() {