[Bug go/123293] go: add an option to ignore "imported and not used" and "declared but not used" errors
bruno at clisp dot org
gcc-bugzilla@gcc.gnu.org
Wed Dec 24 21:50:24 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123293
--- Comment #2 from Bruno Haible <bruno at clisp dot org> ---
> this is an intentional choice for the Go language.
There's a misunderstanding here.
1) I'm not asking for a change in the *language*. I'm fine with the language,
once my source code is in production mode. What I'm asking for is an extra
feature in the compiler, not in the language. Or, if you prefer to think of it
that way: a language _extension_, that would apply in development mode only and
that would be off by default.
2) The justification you point to, in
https://go.dev/talks/2012/splash.article#TOC_7 , is about imported and not used
*packages* : "... guarantees that no extra code will be compiled when building
the program, which minimizes compilation time."
What is the justification regarding unused *variables* ? In the current state,
it forces the developers to add extra code '_ = <variable>' — which wastes
developer time and certainly also somewhat increases compilation time.
More information about the Gcc-bugs
mailing list