Re: [go-nuts] Compilation process and unused-declared variables (func/package) levels

2021-03-02 Thread Ian Lance Taylor
On Tue, Mar 2, 2021 at 9:37 AM Jad wrote: > > I'm new to Go and I would like to understand why the compilation process, > both the compiler and linker, does raise an error for a declared but not used > variable at funcs level in order to ensure clean code while the linker does > not raise this

Re: [go-nuts] Compilation process and unused-declared variables (func/package) levels

2021-03-02 Thread Artur Vianna
Many packages expose useful variables that are not being used themselves, like useful defaults for example. I guess this would be an argument in favor of limiting this kind of behaviour to inside the functions. A good example is image/color/pallete. Also, there is some shenanigans on estimating t

[go-nuts] Compilation process and unused-declared variables (func/package) levels

2021-03-02 Thread Jad
Hi, I'm new to Go and I would like to understand why the compilation process, both the compiler and linker, does raise an error for a declared but not used variable at funcs level in order to ensure clean code while the linker does not raise this error during the build process for declared but