Skip to content

gofmt reorders inline argument comments #19341

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

Closed
improbablejan opened this issue Mar 1, 2017 · 2 comments
Closed

gofmt reorders inline argument comments #19341

improbablejan opened this issue Mar 1, 2017 · 2 comments

Comments

@improbablejan
Copy link

improbablejan commented Mar 1, 2017

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)
}
@ALTree
Copy link
Member

ALTree commented Mar 1, 2017

Thanks for the report.

This is a duplicate of #13113, so I'm closing this one in favour of the older thread.

@ALTree ALTree closed this as completed Mar 1, 2017
@improbablejan
Copy link
Author

Thanks, I tried searching for the issue but couldn't find it.

@golang golang locked and limited conversation to collaborators Mar 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants