You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ST1003: ignore implementations of interfaces from generated code #1702
Compiled with Go version: go1.26.0
Main module:
honnef.co/go/tools@v0.7.0 (sum: h1:w6WUp1VbkqPEgLz4rkBzH/CSU6HkoqNLp6GstyTx3lU=)
Dependencies:
github.com/BurntSushi/toml@v1.6.0 (sum: h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk=)
golang.org/x/exp/typeparams@v0.0.0-20260218203240-3dfff04db8fa (sum: h1:6Wi43P0isP8Nl8D4qJmA3VC4FswVH0RJkr5cauo67SQ=)
golang.org/x/mod@v0.33.0 (sum: h1:tHFzIWbBifEmbwtGz65eaWyGiGZatSrT9prnU8DbVL8=)
golang.org/x/sync@v0.19.0 (sum: h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=)
golang.org/x/tools@v0.42.0 (sum: h1:uNgphsn75Tdz5Ji2q36v/nsFSfR/9BRFvqhGBaJGd5k=)
Code generators like protobuf will often create code that doesn't comply with the Go naming conventions. For example, a protobuf field like user_id will be turned into UserId. The same goes for gRPC method names, that is things like getUserById.
In order to implement the interfaces that gRPC generates, users need to define their own methods, but staticcheck currently triggers ST1003 on them, even when a check like
If staticcheck could see that the interface being implemented is from an autogenerated file, the lint:ignore directives wouldn't be necessary.
I think we can go a step further and do this for all interfaces, not just generated ones. If the interface isn't generated and you're in control of it, we'll flag the offending name there. In all other cases, the name really isn't up to you.
Activity
dominikh commentedon Feb 26, 2026
I think we can go a step further and do this for all interfaces, not just generated ones. If the interface isn't generated and you're in control of it, we'll flag the offending name there. In all other cases, the name really isn't up to you.