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

Comments

Projects
None yet
3 participants
@griesemer
Copy link
Contributor

griesemer commented Feb 14, 2013

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

This comment has been minimized.

Copy link
Contributor

rsc commented Nov 27, 2013

Comment 2:

Labels changed: added go1.3maybe.

@rsc

This comment has been minimized.

Copy link
Contributor

rsc commented Dec 4, 2013

Comment 3:

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

@rsc

This comment has been minimized.

Copy link
Contributor

rsc commented Dec 4, 2013

Comment 4:

Labels changed: added repo-main.

@griesemer

This comment has been minimized.

Copy link
Contributor Author

griesemer commented Apr 21, 2014

Comment 5:

Issue #7817 has been merged into this issue.

@bradfitz

This comment has been minimized.

Copy link
Member

bradfitz commented Feb 2, 2017

Still an issue with Go 1.8.

@griesemer griesemer modified the milestones: Go1.9Maybe, Unplanned Feb 2, 2017

@griesemer

This comment has been minimized.

Copy link
Contributor Author

griesemer commented Jun 20, 2017

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
You can’t perform that action at this time.