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: unhappy formatting of const declaration #4808

Open
griesemer opened this issue Feb 14, 2013 · 6 comments
Open

go/printer: unhappy formatting of const declaration #4808

griesemer opened this issue Feb 14, 2013 · 6 comments
Milestone

Comments

@griesemer
Copy link
Contributor

in go/parser/interface.go:

const (
    PackageClauseOnly Mode             = 1 << iota // parsing stops after package clause
    ImportsOnly                                    // parsing stops after import declarations
    ParseComments                                  // parse comments and add them to AST
    Trace                                          // print a trace of parsed productions
    DeclarationErrors                              // report declaration errors
    SpuriousErrors                                 // same as AllErrors, for backward-compatibility
    AllErrors         = SpuriousErrors             // report all (not just the first 10) errors per file
)

One would expect the "=" to line up. The algorithm for that layout has been
tweaked many times, though. Revisit at some point.
@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 2:

Labels changed: added go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 3:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 4:

Labels changed: added repo-main.

@griesemer
Copy link
Contributor Author

Comment 5:

Issue #7817 has been merged into this issue.

@bradfitz
Copy link
Contributor

bradfitz commented Feb 2, 2017

Still an issue with Go 1.8.

@griesemer griesemer modified the milestones: Go1.9Maybe, Unplanned Feb 2, 2017
@griesemer
Copy link
Contributor Author

This shouldn't be too hard to fix but it's probably again too late. The relevant code is in go/printer/nodes.go, in the keepTypeColumn function. We would want to consider not just "runs of value columns" but also "runs of comment columns" and consider both together to decide whether to drop the type column or not.

@griesemer griesemer modified the milestones: Go1.10, Go1.9Maybe Jun 20, 2017
@rsc rsc modified the milestones: Go1.10, Go1.11 Nov 22, 2017
@griesemer griesemer modified the milestones: Go1.11, Go1.12 Jun 27, 2018
@griesemer griesemer modified the milestones: Go1.12, Unplanned Oct 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants