Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/gopls: fails on $GOROOT/src/cmd/compile/main.go #33548

Open
stamblerre opened this issue Aug 8, 2019 · 5 comments

Comments

@stamblerre
Copy link
Contributor

commented Aug 8, 2019

Forked from #32173, which did not have the correct description of the issue.
It seems the gopls works on the other files in the $GOROOT/src/cmd/compile directory, but it does not work on main.go.

@arthurkiller

This comment was marked as off-topic.

Copy link

commented Aug 14, 2019

Now I can use gopls in vim with ale, but when I run from command line, still got error here

2019/08/14 15:53:56 Info:27.540757ms for GOROOT= GOPATH=/Users/arthur/golang GO111MODULE= PWD=/Users/arthur/golang/src/icode.baidu.com/baidu/personal-code/bdrp-deploy-tool go "list" "-e" "-json" "-compiled=true" "-test=true" "-export=false" "-deps=true" "-find=false" "--" "builtin", stderr: <<>>
2019/08/14 15:53:56 Info:27.569122ms for GOROOT= GOPATH=/Users/arthur/golang GO111MODULE= PWD=/Users/arthur/golang/src/icode.baidu.com/baidu/personal-code/bdrp-deploy-tool go "list" "-m" "-json" "all", stderr: <<go list -m: not using modules
>>
2019/08/14 15:53:56 Info:20.01199ms for GOROOT= GOPATH=/Users/arthur/golang GO111MODULE= PWD=/Users/arthur/golang/src/icode.baidu.com/baidu/personal-code/bdrp-deploy-tool go "env" "GOPATH", stderr: <<>>
2019/08/14 15:53:56 Info:Build info
----------
version v0.1.3, built in $GOPATH mode

Go info
-------
go version go1.12.7 darwin/amd64

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/arthur/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/arthur/golang"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
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/nh/71f5qs9n3dz3v02z77nc86640000gn/T/go-build059041550=/tmp/go-build -gno-record-gcc-switches -fno-common"
2019/08/14 15:53:56 Info:18.628173ms for GOROOT= GOPATH=/Users/arthur/golang GO111MODULE= PWD=/Users/arthur/golang/src/icode.baidu.com/baidu/personal-code/bdrp-deploy-tool go "list" "-m" "-json" "all", stderr: <<go list -m: not using modules
>>
2019/08/14 15:53:56 Info:22.620565ms for GOROOT= GOPATH=/Users/arthur/golang GO111MODULE= PWD=/Users/arthur/golang/src/icode.baidu.com/baidu/personal-code/bdrp-deploy-tool go "env" "GOPATH", stderr: <<>>
2019/08/14 15:53:57 Info:422.385325ms for GOROOT= GOPATH=/Users/arthur/golang GO111MODULE= PWD=/Users/arthur/golang/src/icode.baidu.com/baidu/personal-code/bdrp-deploy-tool go "list" "-e" "-json" "-compiled=true" "-test=true" "-export=false" "-deps=true" "-find=false" "--" "/Users/arthur/golang/src/icode.baidu.com/baidu/personal-code/bdrp-deploy-tool", stderr: <<# runtime/cgo
_cgo_export.c:3:10: fatal error: 'stdlib.h' file not found
>>
2019/08/14 15:53:57 Info:394.960683ms for GOROOT= GOPATH=/Users/arthur/golang GO111MODULE= PWD=/Users/arthur/golang/src/icode.baidu.com/baidu/personal-code/bdrp-deploy-tool go "list" "-e" "-json" "-compiled=true" "-test=true" "-export=false" "-deps=true" "-find=false" "--" "/Users/arthur/golang/src/icode.baidu.com/baidu/personal-code/bdrp-deploy-tool/main.go", stderr: <<# runtime/cgo
_cgo_export.c:3:10: fatal error: 'stdlib.h' file not found
>>
2019/08/14 15:53:57 Info:go/packages.Load
	package = command-line-arguments
	files = [/Users/arthur/golang/src/icode.baidu.com/baidu/personal-code/bdrp-deploy-tool/main.go]
2019/08/14 15:53:57 Info:go/packages.Load
	packages = 1
/Users/arthur/golang/src/icode.baidu.com/baidu/personal-code/bdrp-deploy-tool/main.go:1003:18-25: undeclared name: GetInfo
/Users/arthur/golang/src/icode.baidu.com/baidu/personal-code/bdrp-deploy-tool/main.go:1003:26-33: undeclared name: id2name
/Users/arthur/golang/src/icode.baidu.com/baidu/personal-code/bdrp-deploy-tool/main.go:1008:20-32: undeclared name: getShardInfo
/Users/arthur/golang/src/icode.baidu.com/baidu/personal-code/bdrp-deploy-tool/main.go:220:3-16: undeclared name: InitDatabases
@arthurkiller

This comment was marked as off-topic.

Copy link

commented Aug 14, 2019

And the error is incorrect, gopls can't find the name under the package

@arthurkiller

This comment was marked as off-topic.

Copy link

commented Aug 14, 2019

@stamblerre do you need more evidence?

@arthurkiller

This comment was marked as off-topic.

Copy link

commented Aug 14, 2019

after add env CGO_ENABLED=0 everything goes well.

@stamblerre

This comment has been minimized.

Copy link
Contributor Author

commented Aug 14, 2019

@arthurkiller: This issue is being tracked here: #33462. Please file a new issue if you encounter one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.