What version of Go are you using (go version)?
go version go1.9.2 darwin/amd64
What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/drew/go"
GORACE=""
GOROOT="/usr/local/opt/go/libexec"
GOTOOLDIR="/usr/local/opt/go/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/g3/0kqyss7j5zj0dj3gdkz2m9lw0000gn/T/go-build269266413=/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"
What did you do?
Run gofmt on the following code:
package main
type x struct {
i int
someFunc func()
}
func main() {
_ = &x{
i: 1,
someFunc: func() {
_ = 1
_ = 2
},
}
_ = &x{
i: 1,
someFunc: func() {},
}
}
What did you expect to see?
package main
type x struct {
i int
someFunc func()
}
func main() {
_ = &x{
i: 1,
someFunc: func() {
_ = 1
_ = 2
},
}
_ = &x{
i: 1,
someFunc: func() {},
}
}
Notice the first struct literal, that the value for i is indented to match someFunc as it is in the second literal.
What did you see instead?
The file remains unchanged. This seems to only happen when a multiline function is declared inline.
What version of Go are you using (
go version)?What operating system and processor architecture are you using (
go env)?What did you do?
Run
gofmton the following code:What did you expect to see?
Notice the first struct literal, that the value for
iis indented to matchsomeFuncas it is in the second literal.What did you see instead?
The file remains unchanged. This seems to only happen when a multiline function is declared inline.