go version)?1.9.2
Yes
go env)?Windows 10 (1709) 64-bit
set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\matt\go
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\matt\AppData\Local\Temp\go-build832937591=/tmp/go-build -gno-record-gcc-switches
set CXX=g++
set CGO_ENABLED=1
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
Created maps with long keys.
^ Hit the playground's format button to reproduce the issue
Blocks formatted consistently
Broken Indentation blocks when running Go Fmt.
^ Hit the playground's format button to reproduce the issue
This is by design. Search the issue tracker where @griesemer has explained it a few times.
In general, the best strategy to being happy about gofmt's choices is to not worry about it.
Maybe this needs a FAQ entry. I'll let @griesemer decide whether to keep this bug open as a documentation bug.
Fine to leave this open as documentation issue.
Looking at this again, I admit that the formatting looks pretty ugly in this case. Also, given that this very issue has come up so many times, it may be worthwhile re-investigating the formatting of literals of this form. There's a few solutions I see:
In my opinion, the align all option would be easier for programmers to reason with and understand. 馃憤
Change https://golang.org/cl/104755 mentions this issue: go/printer, gofmt: tuned table alignment for better results
Change https://golang.org/cl/104836 mentions this issue: cmd/coordinator: remove gofmt inconsistency
Most helpful comment
Looking at this again, I admit that the formatting looks pretty ugly in this case. Also, given that this very issue has come up so many times, it may be worthwhile re-investigating the formatting of literals of this form. There's a few solutions I see: