What version of Go are you using (go version)?
Reproduced on two developer machines, one Ubuntu and one Mac.
$ go version
go version go1.16.4 linux/amd64
$ go version
go version go1.16 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
Two outputs, one Ubuntu and one Mac:
go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/xxxxx.xxxxx/.cache/go-build"
GOENV="/home/xxxxx.xxxxx/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/xxxxx.xxxxx/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/xxxxx.xxxxx/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go-1.16"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.16/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16.4"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1372741891=/tmp/go-build -gno-record-gcc-switches"
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/matt.johnston/Library/Caches/go-build"
GOENV="/Users/matt.johnston/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/matt.johnston/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/matt.johnston/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.16"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/yh/jp8vznl910d4w8kb8gs2v4wc0000gq/T/go-build1600909367=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
Archive.zip
I've attached as small of an example as I can get - the error seems to be extremely picky to whitespace - sometimes adding or removing a comment breaks things. I cannot reproduce the error with all code in one file.
The go:noinline are part of debugging what turned out to be a display glitch in GoLand's debugger, trying to create a minimal example in order to reproduce that bug, however now it just breaks the Go compiler.
The gcflags in the following example are what GoLand uses when producing an executable for debugging.
go build -gcflags all="-N -l" *.go
What did you expect to see?
Successful compilation
What did you see instead?
$ go build -gcflags all="-N -l" *.go
# command-line-arguments
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x16f6a7e]
goroutine 1 [running]:
cmd/compile/internal/types.(*Fields).Index(...)
/usr/local/go/src/cmd/compile/internal/types/type.go:422
cmd/compile/internal/gc.typesByString.Less(0xc000878800, 0x2f, 0x2f, 0x1b, 0x26, 0x1)
/usr/local/go/src/cmd/compile/internal/gc/reflect.go:1677 +0x19e
sort.doPivot(0x19bfd98, 0xc0005a10c8, 0x1b, 0x2f, 0xa, 0x1b)
/usr/local/go/src/sort/sort.go:136 +0x4cd
sort.quickSort(0x19bfd98, 0xc0005a10c8, 0x1b, 0x2f, 0xa)
/usr/local/go/src/sort/sort.go:203 +0x97
sort.Sort(0x19bfd98, 0xc0005a10c8)
/usr/local/go/src/sort/sort.go:231 +0x76
cmd/compile/internal/gc.dumpsignats()
/usr/local/go/src/cmd/compile/internal/gc/reflect.go:1548 +0x2b2
cmd/compile/internal/gc.dumpdata()
/usr/local/go/src/cmd/compile/internal/gc/obj.go:124 +0x8a
cmd/compile/internal/gc.Main(0x18c4978)
/usr/local/go/src/cmd/compile/internal/gc/main.go:803 +0x382b
main.main()
/usr/local/go/src/cmd/compile/main.go:52 +0xb1
What version of Go are you using (
go version)?Reproduced on two developer machines, one Ubuntu and one Mac.
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env)?Two outputs, one Ubuntu and one Mac:
go envOutputWhat did you do?
Archive.zip
I've attached as small of an example as I can get - the error seems to be extremely picky to whitespace - sometimes adding or removing a comment breaks things. I cannot reproduce the error with all code in one file.
The go:noinline are part of debugging what turned out to be a display glitch in GoLand's debugger, trying to create a minimal example in order to reproduce that bug, however now it just breaks the Go compiler.
The gcflags in the following example are what GoLand uses when producing an executable for debugging.
go build -gcflags all="-N -l" *.go
What did you expect to see?
Successful compilation
What did you see instead?