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

cmd/fmt: adjacent closing braces on separate lines have same indentation #23021

Closed
willfaught opened this issue Dec 7, 2017 · 3 comments
Closed
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@willfaught
Copy link
Contributor

What did you do?

func main() {
	if a, e := result, (a.F{
			D: &a.D{I: map[s]a.I{
				"2": a.I{I: "2"},
			},
		}, O: []string{"2"}}); !reflect.DeepEqual(a, e) {
		t.Fail()
	}
}

https://play.golang.org/p/P6zFZQH2jJ

Press the format button.

What did you expect to see?

Nothing changed.

What did you see instead?

func main() {
	if a, e := result, (a.F{
		D: &a.D{I: map[s]a.I{
			"2": a.I{I: "2"},
		},
		}, O: []string{"2"}}); !reflect.DeepEqual(a, e) {
		t.Fail()
	}
}

The

D: &a.D{I: map[s]a.I{
	"2": a.I{I: "2"},
},

part was dedented by one tab. Seeing two adjacent

},
},

with the same indentation seems wrong.

System details

go version go1.9.2 darwin/amd64
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/willfaught/Developer/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.9.2/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.9.2/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/_1/ggvd2t1x7hz_185crsb36zlr0000gp/T/go-build489885762=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOROOT/bin/go version: go version go1.9.2 darwin/amd64
GOROOT/bin/go tool compile -V: compile version go1.9.2
uname -v: Darwin Kernel Version 17.2.0: Fri Sep 29 18:27:05 PDT 2017; root:xnu-4570.20.62~3/RELEASE_X86_64
ProductName:	Mac OS X
ProductVersion:	10.13.1
BuildVersion:	17B1003
lldb --version: lldb-900.0.64
  Swift-4.0
@bradfitz bradfitz added this to the Unplanned milestone Dec 7, 2017
@bradfitz bradfitz added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Dec 7, 2017
@dsnet
Copy link
Member

dsnet commented Dec 7, 2017

Is this a duplicate of #16371?

@mvdan
Copy link
Member

mvdan commented Dec 7, 2017

Seems like a dup to me.

@willfaught
Copy link
Contributor Author

willfaught commented Dec 7, 2017 via email

@bradfitz bradfitz closed this as completed Dec 7, 2017
@golang golang locked and limited conversation to collaborators Dec 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

5 participants