Go version
go tip
Output of go env in your module/workspace:
AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN='/home/tklauser/go/bin'
GOCACHE='/home/tklauser/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/tklauser/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2461982940=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/dev/null'
GOMODCACHE='/home/tklauser/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPACKAGESDRIVER=''
GOPATH='/home/tklauser/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/tklauser/src/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/tklauser/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='path'
GOTOOLDIR='/home/tklauser/src/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.28-devel_2c7cbba805a3 Fri Aug 28 00:24:56 2026 -0700'
GOWORK=''
PKG_CONFIG='pkg-config'
What did you do?
Run go fix against the following file (a reduced version of debug/plan9obj/file.go):
package plan9obj
type FileHeader struct {
Magic uint32
Bss uint32
Entry uint64
PtrSize int
LoadAddress uint64
HdrSize uint64
}
type Section struct{}
type File struct {
FileHeader
Sections []*Section
}
func NewFile() *File {
f := &File{FileHeader: FileHeader{
Magic: 0x1234,
Bss: 0x100,
Entry: uint64(0x200),
PtrSize: 4,
LoadAddress: 0x1000,
HdrSize: 4 * 8,
}}
return f
}
What did you see happen?
The formatting of the File.HdrSize assigment looks unexpected:
package plan9obj
type FileHeader struct {
Magic uint32
Bss uint32
Entry uint64
PtrSize int
LoadAddress uint64
HdrSize uint64
}
type Section struct{}
type File struct {
FileHeader
Sections []*Section
}
func NewFile() *File {
f := &File{
Magic: 0x1234,
Bss: 0x100,
Entry: uint64(0x200),
PtrSize: 4,
LoadAddress: 0x1000,
HdrSize: 4 * 8}
return f
}
What did you expect to see?
I'd expect a comma and line break at the end of the HdrSize line and the closing } on the next line:
// other file content same as above
func NewFile() *File {
f := &File{
Magic: 0x1234,
Bss: 0x100,
Entry: uint64(0x200),
PtrSize: 4,
LoadAddress: 0x1000,
HdrSize: 4 * 8,
}
return f
}
Go version
go tip
Output of
go envin your module/workspace:What did you do?
Run
go fixagainst the following file (a reduced version ofdebug/plan9obj/file.go):What did you see happen?
The formatting of the
File.HdrSizeassigment looks unexpected:What did you expect to see?
I'd expect a comma and line break at the end of the
HdrSizeline and the closing}on the next line: