Re:Go: a nice language with an annoying personality
by BarkMore on Friday January 18, 2013 @12:41AM
(#5077332)
When debugging, add the package-level statement var _ = fmt.Println to avoid unused errors. Here's an example: http://play.golang.org/p/cZtmILYWoZ
[ Parent
| on HN ]
Re:Go: a nice language with an annoying personality
by melvinmt on Friday January 18, 2013 @03:15AM
(#5077690)
Even easier: just add _ before you import:
import (
_ "fmt"
)
To prevent the unused var error you can assign the var to an _ as well: _ = unusedVar
Re:Go: a nice language with an annoying personality
by sltkr on Friday January 18, 2013 @09:48AM
(#5078819)
> Even easier: just add _ before you import
How is that an improvement? That's just as much work as commenting the line out.
Re:Go: a nice language with an annoying personality
by melvinmt on Friday January 18, 2013 @11:22AM
(#5079404)
Except that in this case, you can still use the package.
Re:Go: a nice language with an annoying personality
by zeeboo on Friday January 18, 2013 @01:39PM
(#5080201)
No you can't: http://play.golang.org/p/I_pu9oG1uF