Skip to content

gofmt reorders inline argument comments #19341

Closed
@improbablejan

Description

@improbablejan

What version of Go are you using (go version)?

go version
go version go1.8 darwin/amd64

What operating system and processor architecture are you using (go env)?

GOHOSTARCH="amd64"
GOHOSTOS="darwin"

What did you do?

I ran gofmt on

func foo(a string, b string) {
  foo(a, /* blah */ b)
}

What did you expect to see?

I expected the inline comment to stay with the second argument, as that's what it's commenting. I would expect the content to either be unchanged or reformatted to

func foo(a string, b string) {
  foo(a, b /* blah */)
}

What did you see instead?

func foo(a string, b string) {
	foo(a /* blah */, b)
}

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