Go "not enough arguments in call to f" in CI
The compiler counted the arguments at the call and found fewer than the function declares. Go requires every parameter to be supplied, so the call will not compile until it matches.
What this error means
Compilation fails with "not enough arguments in call to f" and prints the expected versus the supplied parameter list.
go build
./handler.go:22:18: not enough arguments in call to NewClient
have (string)
want (string, time.Duration)Common causes
A new parameter was added to the function
The function gained a parameter (a context, a timeout) but a caller still passes the old, shorter argument list.
A variadic was expected to expand but did not
Calling a function that requires fixed parameters with too few values produces this error rather than a runtime panic.
How to fix it
Supply the missing argument
- Read the "have" and "want" lines to see which parameter is missing.
- Pass the additional argument the signature now requires.
- Rebuild to confirm the arity matches.
handler.go
// want (string, time.Duration)
NewClient(addr, 5*time.Second)Update all callers together
When you add a parameter, update every call site in the same change so none is left short.
How to prevent it
- Build the whole module in CI so every caller is type-checked.
- Change a signature and its callers in one commit.
- Use functional options for optional parameters to avoid arity churn.
Related guides
Go "too many return values" in CIFix Go "too many return values" in CI - a return statement lists more values than the function signature decl…
Go "cannot use x (variable of type T) as U value in argument" in CIFix Go "cannot use x (variable of type T) as U value in argument to f" in CI - a value is passed to a functio…
Go "t.Method undefined (type T has no field or method Method)" in CIFix Go "t.Method undefined (type T has no field or method Method)" in CI - a method or field is called on a v…