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

gopls does not support file suffixes #31499

Closed
Naatan opened this issue Apr 16, 2019 · 5 comments
Closed

gopls does not support file suffixes #31499

Naatan opened this issue Apr 16, 2019 · 5 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls.

Comments

@Naatan
Copy link

Naatan commented Apr 16, 2019

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

$ go version
go version go1.12.1 darwin/amd64

Does this issue reproduce with the latest release?

I'm using the latest version of gopls, which has the issue.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN="/Users/nathanrijksen/.go/bin"
GOCACHE="/Users/nathanrijksen/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/nathanrijksen/.go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.12.1/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.12.1/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/nathanrijksen/Projects/cli/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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/sy/r1p6v2k11r11pqql41wljlm80000gn/T/go-build671142049=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Opened a file: virtualenvironment_darwin_windows_test.go and triggered code completions (using vscode)

What did you expect to see?

Code completions

What did you see instead?

Nothing. The error log showed:

Error - 3:38:14 PM] Request textDocument/codeAction failed.
  Message: no file information for file:///Users/nathanrijksen/Projects/cli/internal/virtualenvironment/virtualenvironment_darwin_windows_test.go
  Code: 0 
2019/04/16 15:38:15 get token failed: no packages found for /Users/nathanrijksen/Projects/cli/internal/virtualenvironment/virtualenvironment_darwin_windows_test.go
@Naatan
Copy link
Author

Naatan commented Apr 16, 2019

Using build tags like // +build !linux seems to work fine. The issue appears to be specific to file suffixes.

@ianthehat ianthehat added the gopls Issues related to the Go language server, gopls. label Apr 16, 2019
@ianthehat
Copy link

Files in go only accept a single GOOS suffix, so that filename is equivalent to having the build tag // +build windows and given that you are building on mac it has been excluded from the build, hence gopls will not look at it.
If you set your GOOS to windows gopls would happily work on that file for you.
It would be nice if you could edit with the full power of gopls files that are not included in the default build, but we don't have any good ideas about how to make that work and it is not a high priority compared to some other missing features, sorry.

@Naatan
Copy link
Author

Naatan commented Apr 17, 2019

given that you are building on mac it has been excluded from the build, hence gopls will not look at it.

That doesn't seem like desirable behavior. It's not because I'm developing on Mac that I'm also deploying on Mac.

It would be nice if you could edit with the full power of gopls files that are not included in the default build, but we don't have any good ideas about how to make that work and it is not a high priority compared to some other missing features, sorry.

I could certainly see it not being a high priority but this is an open-source project, you could leave the bug open and mark it as welcome for contributions or something. Closing a ticket is saying "we're not doing this" rather than "this isn't a priority right now".

@ianthehat
Copy link

Sorry, I forgot to also add a link to the other bug, making gopls work for other build tag combinations is already being tracked in #29202

@Naatan
Copy link
Author

Naatan commented Apr 17, 2019

Ahh perfect, thank you!

@golang golang locked and limited conversation to collaborators Apr 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls.
Projects
None yet
Development

No branches or pull requests

3 participants