I believe the first example (the one without the last comma) is when you 
want to put everything on the same line. The second example (the one with 
the last comma) is when you want to split the items into separate lines. 
They each have different uses. It is awkward to see this `{ 'A', 'B', 'C', 
'E', }` when they are put on the same line. So I disagree that the last 
comma should be obligatory.

Your example could use a better line separation to add clarity. 

On Tuesday, April 10, 2018 at 6:32:45 AM UTC+7, Alex Dvoretskiy wrote:

> Hello Golangnuts,
> Why there is no difference if the last comma exists?
> {'A', 'B', 'C', 'E'}  
> or
> {'A', 'B', 'C', 'E',}
> both are valid.
> Sometimes it causes little troubles. For example, the second snippet 
> wouldn't compile, because of different formatting. But these two snippets 
> are identical technically. So, you have to add this last comma to keep the 
> formatting you want. Which can be annoying.
> https://play.golang.org/p/4Vav9n2_NIc
> https://play.golang.org/p/pr2h6_FBxFn
> I think it's very good idea to make the last comma obligatory.

You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to