go: cmd/go: error isn't properly reported when running go list on cgo package with missing pkg-config
What version of Go are you using (go version
)?
$ go version go version go1.13.3 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/Users/muir/Library/Caches/go-build" GOENV="/Users/muir/Library/Application Support/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/muir/projects/<project>/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" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="" 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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/_q/1xpb0k992ll803xsldpx0qyr0000gn/T/go-build252385107=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
I opened a non-cgo package in our project. The package does not transitively depend on any cgo packages.
What did you expect to see?
I expected gopls to load the package with no issue.
What did you see instead?
gopls failed to create the view due to a go list
“missing pkg-config” error.
LSP :: Error loading workspace folders (expected 1, got 0)
failed to load view for file:///Users/muir/projects/<project>/go/src: error loading packages: go [list -e -json -compiled=true -test=true -export=false -deps=true -find=false -- ./...]: exit status 2: # pkg-config --cflags -- <bunch of libraries>
pkg-config: exec: "pkg-config": executable file not found in $PATH
Elsewhere, our project has a cgo package that uses the cgo pkg-config directive (e.g. // #cgo pkg-config: some-library
). My laptop doesn’t currently have pkg-config installed.
I assume the error comes from the go list ./...
we do now when creating a view.
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 17 (10 by maintainers)
Hot dog! Yes, seems to start up fine now.