Skip to content

cmd/gofmt: Inconsistent alignment of struct field values #7819

@gopherbot

Description

@gopherbot

by waters@google.com:

What does 'go version' print?

1.2, and using version from playground.

What steps reproduce the problem?

http://play.golang.org/p/tXDIgmPIky

What happened?

{
    Field:                     value,
    LongerField:               value,
    EspeciallyEvenLongerField: value,
    Field: value,
},

What should have happened instead?

{
    Field:                     value,
    LongerField:               value,
    EspeciallyEvenLongerField: value,
    Field:                     value,
},

Please provide any additional information below.

There appears to be logic in gofmt which avoids aligning long field values, but this is
inconsistent when a field is short after a long one.  See play link for other examples.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions