Skip to content
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

go/printer: blank lines at top/bottom of composite literal handled differently by gofmt #23143

Open
willfaught opened this Issue Dec 14, 2017 · 3 comments

Comments

Projects
None yet
4 participants
@willfaught
Copy link
Contributor

willfaught commented Dec 14, 2017

Searched and didn't find a duplicate issue.

Does this issue reproduce with the latest release?

Yes.

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

play.golang.org

What did you do?

var x = []int{

	1,
	2,
	3,

}

https://play.golang.org/p/xDO9L4ROUA (press the format button)

What did you expect to see?

Either both blank lines in the composite literal removed, or neither of them removed.

What did you see instead?

The bottom blank line is removed, but not the top.

@bradfitz bradfitz added this to the Unplanned milestone Dec 15, 2017

@bradfitz bradfitz changed the title cmd/fmt: blank lines at top/bottom of composite literal handled differently go/printer: blank lines at top/bottom of composite literal handled differently by gofmt Dec 15, 2017

@bradfitz

This comment has been minimized.

Copy link
Member

bradfitz commented Dec 15, 2017

The typical answer to gofmt bug reports is to relax and accept whatever gofmt gives you, but I'll let @griesemer decide. This might be a dup of #6996.

@willfaught

This comment has been minimized.

Copy link
Contributor Author

willfaught commented Dec 15, 2017

Ah, could be. I searched for composite literals specifically, but it could be a more general block issue.

@griesemer

This comment has been minimized.

Copy link
Contributor

griesemer commented Dec 15, 2017

See also #18264. Leaving open for now.

@griesemer griesemer modified the milestones: Unplanned, Go1.11 Dec 15, 2017

@griesemer griesemer modified the milestones: Go1.11, Unplanned Jun 27, 2018

@ALTree ALTree added the NeedsDecision label Mar 3, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.