Skip to content

go/packages: ignore cgo errors #33462

Closed
Closed
@bwmarrin

Description

@bwmarrin

What version of Go are you using (go version)?

$ go version
go version go1.12.7 linux/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
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/bwmarrin/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/bwmarrin/.go"
GOPROXY=""
GORACE=""
GOROOT="/home/bwmarrin/.go/root"
GOTMPDIR=""
GOTOOLDIR="/home/bwmarrin/.go/root/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
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=/tmp/go-build824270571=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Opened a new temp package in my GOPATH src folder. Tested auto completion and it worked fine. Then I added an import for the http package. Then I tested and auto completion no longer worked for items within my temp package.

After hunting down some other issues, I found the below command.

go list -e -json -compiled

Running that without the http package returned details without an error. Running it with the http package returned an error, along with the details I expected.

exec: "gcc": executable file not found in $PATH

Which, I assume is to say gcc is required for this to work right. So I installed gcc, and now everything works as expected.

I'm not sure if this is a bug, or working as intended. It took me several hours to figure out why my auto completion wasn't working and thought I'd share it here in case it wasn't intended behaviour and so maybe others might be helped, possibly.

What did you expect to see?

I expected go auto completion to "just work" even after adding the http package without needing to install a compiler I didn't think I needed.

What did you see instead?

Auto completion failed to work for things within the test package after adding http import.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.goplsIssues related to the Go language server, gopls.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions