From b7f6a0667564a98e56967ccdf44197bc156aacd3 Mon Sep 17 00:00:00 2001 From: Fernandez Ludovic Date: Sun, 13 Apr 2025 22:04:01 +0200 Subject: [PATCH] fix: skip function with variadics --- processor.go | 4 ++++ testdata/proto/tassert.go | 12 ++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 testdata/proto/tassert.go diff --git a/processor.go b/processor.go index 4742e6b..0324e7a 100644 --- a/processor.go +++ b/processor.go @@ -102,6 +102,10 @@ func (c *processor) process(n ast.Node) (*Result, error) { } } + if len(paramTypes) != len(x.Args) { + return &Result{}, nil + } + for i, arg := range x.Args { a, ok := arg.(*ast.SelectorExpr) if !ok { diff --git a/testdata/proto/tassert.go b/testdata/proto/tassert.go new file mode 100644 index 0000000..ffe7899 --- /dev/null +++ b/testdata/proto/tassert.go @@ -0,0 +1,12 @@ +package proto + +import ( + "net/http" + "testing" +) + +func _(tb testing.TB, client *http.Client, req *http.Request, statusCode int) { + Errorf(tb, false, "expected %v status code, got %v %v", statusCode, req.URL, client.Transport) +} + +func Errorf(tb testing.TB, cond bool, format string, args ...any) {}