Skip to content

Groups with comments below single var declaration are unexpectedly formatted #256

@ndrpnt

Description

@ndrpnt

This is more of a question. The current behavior:

var (
	foo = "foo"
	// bar = "bar"
	// baz = "baz"
)
var foo = "foo" // bar = "bar"
// baz = "baz"

Is it desired ? I would expect gofumpt to either keep the parentheses and comments untouched, or to format this way:

var foo = "foo"
// bar = "bar"
// baz = "baz"

This is also consistent with the behavior when adding an inline comment:

var (
	foo = "foo" // foo
	// bar = "bar"
	// baz = "baz"
)
var foo = "foo" // foo
// bar = "bar"
// baz = "baz"

I have no strong opinion on the matter, I just found it surprising. Feel free to close if this is intended

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions