1

currently using go version go1.20 linux/amd64

go env

GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/mandark/.cache/go-build"
GOENV="/home/mandark/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/mandark/go/pkg/mod"
GONOPROXY="gitlab.com"
GONOSUMDB="gitlab.com"
GOOS="linux"
GOPATH="/home/mandark/go"
GOPRIVATE="gitlab.com"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/mandark/sdk/go1.20"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/mandark/sdk/go1.20/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.20"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/mandark/go/src/gitlab.com/shaadi/profile-api/go.mod"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3971895452=/tmp/go-build -gno-record-gcc-switches"

I Tried to create a debug build using go build -gcflags="all=-N -l" -o test .

But it is giving me

# gitlab.com/xyz/repo/pkg/profile
../../pkg/profile/state_mapping.go:8:5: internal compiler error: NewBulk too big: nbit=20196 count=986153 nword=632 size=623248696

Please file a bug report including a short program that triggers the error.
https://go.dev/issue/new

Checked the file, originally it contained static mapping, but after removing all the mappings and making it empty it is showing the same error.

Modified file contents:

package profile

type CountryData struct {
    Country     string
    CountryCode string
}

var StateMapping = map[string][]CountryData{}

Still giving internal compiler error: NewBulk too big... error message when tried to debug the build.

Tried to create a debug build for go service. Wanted to debug the code.

  • 1
    https://github.com/golang/go/issues/48375 and https://github.com/golang/go/issues/33437 – rocka2q Aug 01 '23 at 12:41
  • I am unable to reproduce your error using your modified file: https://go.dev/play/p/7dJRhWAb99E. Command `$ go1.20 version && go1.20 build -gcflags="all=-N -l" -o test .`. Output `go version go1.20.6 linux/amd64`. – rocka2q Aug 01 '23 at 13:15
  • If you are still getting that compiler error after removing the `StateMapping` initialization literals that implies you have another source file with a huge number of initialization literals. Or you aren't compiling the modified source like you think. – Kurtis Rader Aug 01 '23 at 18:59
  • @KurtisRader, there might be huge literals but after removing state mapping, it started giving issue in other functions which are present in code from long time and the debug is working as expected in main branch. (The statemapping is present in a feature branch) – Mandar Kulkarni Aug 02 '23 at 06:32
  • @MandarKulkarni, I don't understand what "it started giving issue in other functions" means. Did you, or did you not, get the same compiler error after removing the huge `StateMapping` initialization literals? The wording of your comment suggests you saw a different compiler error. I realize that English is probably not your native language but your problem statement and subsequent comments suggest you have very poor debugging skills. – Kurtis Rader Aug 02 '23 at 06:47
  • @KurtisRader, I have a feature branch containing huge map and my master branch does not contain that map hence debugging is working on the master branch Now coming to the feature branch, after I removed all items of the map (making it empty) debug build failed with the above-mentioned error at the same line. Post which I also removed the declaration and usage of map from code base and tried, which produced the same error message on different file and line, this file is present in master branch on which debug builds are getting created without error. Please ask/suggest if I missed anything. – Mandar Kulkarni Aug 02 '23 at 13:32

0 Answers0