News for hackers. Stuff that matters.
Re:Golang Diaries I by jzelinskie on Monday June 17, 2013 @07:54AM (#5892630)
>Golang will not let you compile if there’s an import or declared variable that’s unused. OK, I understand that Cleanliness Is Next To Godliness, but this is seriously slowing me down; probably a third of my attempts to run my damn program fail because I’ve forgotten to remove debugging apparatus, or I’ve sketched in a variable but not used it yet. How about a compiler switch or something?

I don't find this an issue with vim using syntastic. When I save, I get notified in the gutter of issues like this and then I can use the official go vim support to do things like :Drop to remove the import without even navigating to the imports section. Syntastic picks up on most issues before you even think of compiling.

>There doesn’t seem to be a way to declare a constant array, what in a Java class I’d call final static String[] COLS = {"Red", "Blue"};

Constants in Go are evaluated at compile time and arrays don't exist at compile time. You can manage at the package level by using a unexported variable then exporting a function that returns it.

Re:Golang Diaries I by saljam on Monday June 17, 2013 @09:52AM (#5893106)
Furthermore, Java is quite happy to let you do COLS[1] = "Green". All that is constant about that array is the reference.
Re:Golang Diaries I by justinhj on Monday June 17, 2013 @10:44AM (#5893447)
Using go mode, autocomplete and goflymake helps a lot on emacs too.