Go "go vet" failures block go test - Fix in CI
go test runs a subset of go vet before executing tests. A vet finding - like a bad Printf verb - fails the run before any test executes.
What this error means
A run fails with a vet message such as Printf format %d has arg of wrong type string and [vet failed], even though the tests themselves are fine. It means the implicit vet pass flagged code.
# example.com/app
./log.go:12:2: Printf format %d has arg s of wrong type string
FAIL example.com/app [build failed]Common causes
A real vet issue in the package
go test ran vet and found a genuine problem, such as a format-verb mismatch or a misused lock.
A vet check too strict for the code
A specific vet analyzer flags a pattern you intend to keep, blocking the test run.
How to fix it
Fix the vet finding
- Correct the flagged code, e.g. match the Printf verb to the argument type.
- Re-run go vet to confirm it is clean.
go vet ./...
go test ./...Scope the vet pass deliberately
- If a specific analyzer is wrong for your code, disable just that check rather than all vetting.
go test -vet=off ./... # last resort, prefer fixing the findingHow to prevent it
- Run
go vet ./...locally before pushing. - Treat vet findings as build failures, not warnings.
- Keep Printf verbs aligned with argument types.