Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/printer: consider permitting one-line "enum" const decls #13403

Open
griesemer opened this Issue Nov 25, 2015 · 5 comments

Comments

Projects
None yet
3 participants
@griesemer
Copy link
Contributor

griesemer commented Nov 25, 2015

A declaration of the form:

const (
    Do = iota; Re; Mi; Fa; Sol; La; Ti;
)

gets formatted as:

const (
    Do = iota
    Re
    Mi
    Fa
    Sol
    La
    Ti
)

The former is close to what in other languages might be achieved with an "enum" declaration. If there's several such simple const decls, the latter form uses undue amount of space w/o much readability benefit.

Consider recognizing this special case and not introduce line-breaks if there were none in the original source.

@griesemer griesemer self-assigned this Nov 25, 2015

@griesemer griesemer added this to the Unplanned milestone Nov 25, 2015

@agnivade

This comment has been minimized.

Copy link
Member

agnivade commented Apr 26, 2018

I can take a stab at this. @griesemer - Let me know if you already had something planned.

@griesemer

This comment has been minimized.

Copy link
Contributor Author

griesemer commented Apr 26, 2018

@agnivade You're welcome to investigate and play with it but I am probably not going to look at this (or any related CLs) any time soon. We have a freeze coming up on May 1 and this is not important at all and we many more important issues to tackle at the moment. Thanks.

@agnivade

This comment has been minimized.

Copy link
Member

agnivade commented Apr 26, 2018

Got it. Thanks.

@agnivade agnivade assigned agnivade and unassigned griesemer Apr 26, 2018

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Apr 27, 2018

Change https://golang.org/cl/109795 mentions this issue: go/printer: allow single-line const enum declarations

@griesemer

This comment has been minimized.

Copy link
Contributor Author

griesemer commented Sep 5, 2018

The pending CL seems ok but I think we need to determine if we actually want this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.