go version)?$ go version go version go1.14.3 linux/amd64
Not related.
go env)?go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/oktay/.cache/go-build"
GOENV="/home/oktay/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/oktay/go"
GOPRIVATE=""
GOPROXY="direct"
GOROOT="/usr/lib/golang"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/oktay/Code/elver/go.mod"
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-build278188456=/tmp/go-build -gno-record-gcc-switches"
go get -u golang.org/x/tools/cmd/goimportsgoimportsNot a panic.
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x5cfda5]
goroutine 1 [running]:
main.init.0()
/home/oktay/go/src/golang.org/x/tools/cmd/goimports/goimports.go:51 +0x85
I believe this was introduced by this PR: https://github.com/golang/tools/commit/e31c80b82c039b355c6214fa13610c2bf347612d#diff-5e717961381d0f3730aa5f9ee4e11ebc
Env is no longer specified, leading to a panic when trying to parse command line flags.
I'm experiencing the same problem
go get golang.org/x/tools/cmd/goimports
go: finding golang.org/x/tools latest
goimports -w .
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x11cda35]
goroutine 1 [running]:
flag.newStringValue(...)
/usr/local/Cellar/go/1.13/libexec/src/flag/flag.go:226
flag.StringVar(...)
/usr/local/Cellar/go/1.13/libexec/src/flag/flag.go:757
main.init.0()
/Users/me/Server/Go/pkg/mod/golang.org/x/[email protected]/cmd/goimports/goimports.go:51 +0x85
make: *** [style] Error 2
Here's a PR that fixes the issue: https://github.com/golang/tools/pull/239
the same problem
+1
Apologies for the breakage, and thanks @annirudh for the diagnosis and fix. The bug is now fixed; module mode users may need to wait ~half an hour for proxy.golang.org to update, or explicitly update to 7480c7b.
Most helpful comment
I believe this was introduced by this PR: https://github.com/golang/tools/commit/e31c80b82c039b355c6214fa13610c2bf347612d#diff-5e717961381d0f3730aa5f9ee4e11ebc
Envis no longer specified, leading to a panic when trying to parse command line flags.