News for hackers. Stuff that matters.
Re:The Beauty of COBOL (2018) by onei on Friday October 18, 2019 @08:42AM (#21290866)
I've seen go code fail to compile because a closing } was on the next line and there wasn't a trailing comma. I'd fully expect a formatter to handle that kind of minutiae for me.
Re:The Beauty of COBOL (2018) by thwarted on Friday October 18, 2019 @10:36AM (#21291730)
I've seen go code fail to compile because a closing } was on the next line and there wasn't a trailing comma.

That actually is a syntax error, as go enforces (that is they are not optional) trailing commas. gofmt only formats syntactically correct code.

Re:The Beauty of COBOL (2018) by onei on Friday October 18, 2019 @03:15PM (#21294252)
I get that a formatter should reject syntactically incorrect code, but I question why it's syntax error in the first place. Coming from using black with python, I generally leave the trailing comma there but for the compiler to care seems weird when there's a standard formatter available.
Re:The Beauty of COBOL (2018) by thwarted on Saturday October 19, 2019 @12:05AM (#21296708)
The compiler cares because they want to enforce this standard (and it may make the parser slightly simpler). That there is a mix, or at least a non-obvious break between what the compiler enforces and what the formatter will accept and produce is an inconsistency in go, I suppose, but not necessarily worse than arbitrary decisions made in other languages.
Re:The Beauty of COBOL (2018) by K0SM0S on Friday October 18, 2019 @09:01AM (#21290982)
Oh absolutely, do use gofmt, always.

The above example was just to make a point, and perhaps give insights into how the compiler works.

IMHO, Go's 'enforcement' of common formatting is powerful; it has an incredible compound effect which gains momentum as you get acquainted with the language.