Closed qianzhangxa closed 6 months ago
It is https://github.com/golang/go/issues/29202 (os/arch in filenames serve like build tags).
Good news - the upcoming version of the language server is going to improve the build tag handling. gopls v0.15.0-pre.1 is currently out for testing. Can you give it a try and provide feedback/bug reports? (cc @findleyr)
go install golang.org/x/tools/gopls@v0.15.0-pre.1
And run "Go: Restart Language Server" command.
@hyangah Yes, gopls v0.15.0-pre.1 has fixed this issue, thanks!
BTW, do you happen to know when gopls v0.15.0 will be released?
@qianzhangxa we're taking out time as this is a large change and we want to have another prerelease, but probably within the next few weeks. Thank you for testing.
Closing as this will be fixed by gopls@v0.15.0.
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
* Run `go version` to get version of Go from _the VS Code integrated terminal_. - 1.21.5 * Run `gopls -v version` to get version of Gopls from _the VS Code integrated terminal_. - v0.14.2 * Run `code -v` or `code-insiders -v` to get version of VS Code or VS Code Insiders. - 1.85.1 * Check your installed extensions to get the version of the VS Code Go extension - v0.40.1 * Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > `Go: Locate Configured Go Tools` command. ``` Checking configured tools.... GOBIN: undefined toolsGopath: gopath: /Users/qzhang/go GOROOT: /Users/qzhang/sdk/go1.21.5 PATH: /Users/qzhang/sdk/go1.21.5/bin:/usr/local/Cellar/pyenv-virtualenv/1.2.1/shims:/Users/qzhang/.pyenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/qzhang/bin:/usr/local/go/bin PATH (vscode launched with): /usr/local/Cellar/pyenv-virtualenv/1.2.1/shims:/Users/qzhang/.pyenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/qzhang/bin:/usr/local/go/bin go: /Users/qzhang/sdk/go1.21.5/bin/go: go version go1.21.5 darwin/amd64 gopls: /Users/qzhang/go/bin/gopls (version: v0.14.2 built with go: go1.21.5) gotests: not installed gomodifytags: not installed impl: not installed goplay: not installed dlv: /Users/qzhang/go/bin/dlv (version: v1.21.2 built with go: go1.21.5) staticcheck: /Users/qzhang/go/bin/staticcheck (version: v0.4.6 built with go: go1.21.5) go env Workspace Folder (kubernetes): /Users/qzhang/Works/projects/go/src/k8s.io/kubernetes GO111MODULE='' GOARCH='amd64' GOBIN='' GOCACHE='/Users/qzhang/Library/Caches/go-build' GOENV='/Users/qzhang/Library/Application Support/go/env' GOEXE='' GOEXPERIMENT='' GOFLAGS='' GOHOSTARCH='amd64' GOHOSTOS='darwin' GOINSECURE='' GOMODCACHE='/Users/qzhang/go/pkg/mod' GONOPROXY='' GONOSUMDB='' GOOS='darwin' GOPATH='/Users/qzhang/go' GOPRIVATE='' GOPROXY='https://proxy.golang.org,direct' GOROOT='/Users/qzhang/sdk/go1.21.5' GOSUMDB='sum.golang.org' GOTMPDIR='' GOTOOLCHAIN='auto' GOTOOLDIR='/Users/qzhang/sdk/go1.21.5/pkg/tool/darwin_amd64' GOVCS='' GOVERSION='go1.21.5' GCCGO='gccgo' GOAMD64='v1' AR='ar' CC='clang' CXX='clang++' CGO_ENABLED='1' GOMOD='/Users/qzhang/Works/projects/go/src/k8s.io/kubernetes/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 -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/7d/xksqy41d6fld6c9x9y2z8kmw0000gn/T/go-build2905093160=/tmp/go-build -gno-record-gcc-switches -fno-common' ```
Share the Go related settings you have added/edited
Describe the bug
I am using VS code with Go extension to check Kubernetes source code in my macOS, and I found for any files which have
linux
orwindows
in their names (e.g.cgroup_manager_linux.go
), I always get this error:Steps to reproduce the behavior:
linux
orwindows
in their names.