Skip to content

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

Open
@griesemer

Description

@griesemer

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions