Skip to content

Commit

Permalink
chore: cleanup and rm unused func (#164)
Browse files Browse the repository at this point in the history
Signed-off-by: Sasha Melentyev <sasha@m8.ru>
  • Loading branch information
sashamelentyev committed Mar 22, 2024
1 parent 986b50e commit 0e90b50
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 30 deletions.
6 changes: 1 addition & 5 deletions gomock/call.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]",
Expand Down
24 changes: 0 additions & 24 deletions mockgen/generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"fmt"
"go/ast"
"go/token"
"strings"

"go.uber.org/mock/mockgen/model"
)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion mockgen/mockgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 0e90b50

Please sign in to comment.