What version of Go are you using (go version)?
$ go version
go version go1.15.2 darwin/amd64
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/cbandy/Library/Caches/go-build"
GOENV="/Users/cbandy/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/cbandy/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/cbandy/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/cbandy/.local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/cbandy/.local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/bw/_dxdzsmx6h1ffcgp6rvfh55c0000gn/T/go-build600613638=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
Ran gofmt -s -w on the following code: https://play.golang.org/p/CXEb-91Y6Mm
package main
func f(a interface{}) func(b interface{}) {
return func(interface{}) {}
}
type s struct{}
func (s) m(a interface{}) func(b interface{}) {
return func(interface{}) {}
}
func main() {
f("a")("b")
f("a")(
"b",
)
f("a")([]string{
"b",
})
f(
"a",
)(
"b",
)
s{}.
m("a")("b")
s{}.
m("a")(
"b",
)
s{}.
m(
"a",
)(
"b",
)
s{}.
m("a")([]string{
"b",
})
}
What did you expect to see?
(I expected no changes to the indentation because) I expected closing brackets to be indented the same amount as the line of their matching open brackets.
What did you see instead?
On some of the chained method calls, the closing brackets are indented one level less. Starting on L29, the output is:
s{}.
m("a")(
"b",
)
s{}.
m(
"a",
)(
"b",
)
s{}.
m("a")([]string{
"b",
})
--- main.go.orig
+++ main.go
@@ -28,16 +28,16 @@
m("a")("b")
s{}.
m("a")(
- "b",
- )
+ "b",
+ )
s{}.
m(
"a",
)(
- "b",
- )
+ "b",
+ )
s{}.
m("a")([]string{
- "b",
- })
+ "b",
+ })
}
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env)?go envOutputWhat did you do?
Ran
gofmt -s -won the following code: https://play.golang.org/p/CXEb-91Y6MmWhat did you expect to see?
(I expected no changes to the indentation because) I expected closing brackets to be indented the same amount as the line of their matching open brackets.
What did you see instead?
On some of the chained method calls, the closing brackets are indented one level less. Starting on L29, the output is: