Skip to content

gopls does not support file suffixes #31499

Closed
@Naatan

Description

@Naatan

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

Activity

Naatan

Naatan commented on Apr 16, 2019

@Naatan
Author

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

added
goplsIssues related to the Go language server, gopls.
on Apr 16, 2019
ianthehat

ianthehat commented on Apr 16, 2019

@ianthehat

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

Naatan commented on Apr 17, 2019

@Naatan
Author

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

ianthehat commented on Apr 17, 2019

@ianthehat

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

Naatan commented on Apr 17, 2019

@Naatan
Author

Ahh perfect, thank you!

locked and limited conversation to collaborators on Apr 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgegoplsIssues related to the Go language server, gopls.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Naatan@ianthehat@gopherbot

        Issue actions

          gopls does not support file suffixes · Issue #31499 · golang/go