Ok, the Go language is kind of broken

AHHHHHH! “You should never put the opening brace of a control structure (if, for, switch, or select) on the next line. If you do, a semicolon will be inserted before the brace, which could cause unwanted effects. Write them like this”

Go should be easy for C/C++/Objective-C developers to pick up but why in the world would you make it retarded from the get go? Who’s screwball idea was it to require the opening brace to be on the same line? It’s like we’re coding in COBOL again. Oh, that’s right, Google is big into Python. I forgot.

I still find it odd that people stick to K&R style.

By Rob Fahrni

Husband / Father / Developer

5 replies on “Ok, the Go language is kind of broken”

And I hate the style with the brace on the next line. I just hate the extra vertical white space it causes.

But it’s still broken that you’re forced to choose an indentation style. Either you do it like Python and make whitespace significant, or you do it like the C-based languages and use braces and semicolons so you can format things the way you want.

This sounds like the worst of both worlds.

Hey Tommy!

I’m surprised at Microsoft you’re using K&R style. I guess these things are trendy like everything else. 🙂 To each his own.

But, as you said, it’s bad design to force you to do it.

I never liked that style either, but I’ve been doing a bit of android development ( java in eclipse) and it’s just easier to go with the flow… And I’ve progressed to the “not hating” stage for this style.. Still prefer more the old way, but not vomiting anymore…

You know how weird I can be about this stuff Tony. To this day I still regret blowing up at you. I’ll say it once again. I am very sorry about that.

That said, I can adjust to any coding style. I’ve had to do it everywhere I’ve been. The one constant in all the places has been opening brace on the next line, so it’s fairly easy to change.

What I hate about this style is if you have a number of arguments, and you want to enforce some limit on the number of columns, you’re screwed. You’re forced to either A. put all arguments on one line, and force anyone looking at your code to scroll to the right, or B. put additional arguments on the next line. If you don’t indent the additional arguments- well, I’ve never seen anyone write it that way because it would look atrocious. If you do indent the next line, then there’s no clear delineation between the second line with more arguments and the line where the method body begins.

Now, too many arguments is usually a smell. But sometimes the names or types are long enough that after three or so you get into this problem. Saying code should never be like this is asinine and doesn’t address the problem, because real code often becomes this way even if you force a convention that makes it look ugly, because people who write code like this don’t care.

I also find it hilarious Go won’t allow this:

func main()
fmt.Println(“Hello, 世界”)
but does allow this:
func main(
) {
fmt.Println(“Hello, 世界”)

Comments are closed.