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 to load package for test file #41081

Closed
dylankb opened this issue Aug 27, 2020 · 6 comments
Closed

x/tools/gopls: fails to load package for test file #41081

dylankb opened this issue Aug 27, 2020 · 6 comments
Labels
Milestone

Comments

@dylankb
Copy link

@dylankb dylankb commented Aug 27, 2020

VSCode fails to execute commands such as "Go to Definition" while using gopls on my machine for *_test.go files. In other words, it does not reveal the requested source code or preview for the command. Additionally, I see gopls server error logs when I open any of these files in my VSCode editor and when using gopls check. This is not the case in non-test files in the same packages.

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

$ go version
go version go1.14.3 darwin/amd

Does this issue reproduce with the latest release?

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

go env Output
$ go env
```
GO111MODULE="auto"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/dbarnard/Library/Caches/go-build"
GOENV="/Users/dbarnard/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/dbarnard/Code/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/dbarnard/Code/goroots/go14"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/dbarnard/Code/goroots/go14/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/$MYPROJECT/go.mod" # edited
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/50/6mrh5v7n0zz08h1jf4vn71n00000gn/T/go-build385179261=/tmp/go-build -gno-record-gcc-switches -fno-common"
```

gopls related VSCode settings

{
   ...
   "go.useLanguageServer": true,
    "[go]": {
        "editor.formatOnSave": true,
        "editor.codeActionsOnSave": {
            "source.organizeImports": true,
        },
        // Optional: Disable snippets, as they conflict with completion ranking.
        "editor.snippetSuggestions": "none",
    },
    "[go.mod]": {
        "editor.formatOnSave": true,
        "editor.codeActionsOnSave": {
            "source.organizeImports": true,
        },
    },
    "gopls": {
         // Add parameter placeholders when completing a function.
        "usePlaceholders": true,

        // If true, enable additional analyses with staticcheck.
        // Warning: This will significantly increase memory usage.
        "staticcheck": false,
    },
    "go.languageServerFlags": [
        "-rpc.trace", // for more detailed debug logging
        "serve",
        "--debug=localhost:6060", // to investigate memory usage, see profiles
    ],
}

What did you do?

I'm not certain when or if a breakage occurred since other editors are in use on my team, but I can try to reproduce a more minimal example if this information is not enough.

What did you expect to see?

When I navigate to a file I don't expect to see RPC trace errors for the gopls server. For example, navigating to an /internal/db_test.go file. When I navigate to /internal/db.go, I do not see these errors.

// No error when opening /internal/db.go in VSCode
[Trace - 15:39:31.092 PM] Sending request 'textDocument/documentLink - (243)'.
Params: {"textDocument":{"uri":"file:///Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go"}}


[Trace - 15:39:31.092 PM] Sending request 'textDocument/codeAction - (244)'.
Params: {"textDocument":{"uri":"file:///Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go"},"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}},"context":{"diagnostics":[]}}

When I clickGo to Definition I expect the editor to navigate to the source code at defined either in the temporary modules cache or a file within the project directory. I also don't expect to see gopls errors in the RPC trace when hovering or clicking Go.

Similarly, I expect gopls check to not return errors for test files - no errors for non-test files.

gopls check /Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db.go

What did you see instead?

$ go clean --modcache
$ go mod tidy

When I navigate to an *_test.go file, I see RPC and see trace errors in the gopls server. Here I'm navigating to an /internal/db_test.go file.

// When navigating to /internal/db_test.go in VSCode
[Trace - 15:20:51.818 PM] Sending request 'textDocument/documentLink - (205)'.
Params: {"textDocument":{"uri":"file:///Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go"}}


[Trace - 15:20:51.818 PM] Sending request 'textDocument/codeAction - (206)'.
Params: {"textDocument":{"uri":"file:///Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go"},"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}},"context":{"diagnostics":[]}}


[Trace - 15:20:51.984 PM] Sending request 'textDocument/foldingRange - (207)'.
Params: {"textDocument":{"uri":"file:///Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go"}}


[Trace - 15:20:52.031 PM] Sending request 'textDocument/codeLens - (208)'.
Params: {"textDocument":{"uri":"file:///Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go"}}


[Trace - 15:20:52.056 PM] Sending request 'textDocument/codeAction - (209)'.
Params: {"textDocument":{"uri":"file:///Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go"},"range":{"start":{"line":27,"character":41},"end":{"line":27,"character":41}},"context":{"diagnostics":[]}}


[Trace - 15:20:52.057 PM] Sending notification '$/cancelRequest'.
Params: {"id":206}


[Trace - 15:20:52.461 PM] Sending request 'textDocument/hover - (210)'.
Params: {"textDocument":{"uri":"file:///Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go"},"position":{"line":25,"character":12}}


[Trace - 15:20:52.480 PM] Received response 'textDocument/documentLink - (205)' in 662ms.
Result: null


[Trace - 15:20:52.480 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2020/08/27 15:20:52 go/packages.Load\n\tsnapshot=21\n\tdirectory=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT\n\tquery=[file=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go]\n\tpackages=0\n"}


[Error - Received] 15:20:52.480 PM #206 JSON RPC cancelled


[Trace - 15:20:52.481 PM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2020/08/27 15:20:52 failed to compute document links: \u003cnil\u003e: packages.Load error\n\tURI=file:///Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go\n"}


[Info  - 3:20:52 PM] 2020/08/27 15:20:52 go/packages.Load
	snapshot=21
	directory=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT
	query=[file=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go]
	packages=0

[Error - 3:20:52 PM] 2020/08/27 15:20:52 failed to compute document links: <nil>: packages.Load error
	URI=file:///Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go

[Trace - 15:20:52.482 PM] Received response 'textDocument/foldingRange - (207)' in 497ms.
Result: [{"startLine":4,"startCharacter":8,"endLine":17,"endCharacter":33,"kind":"imports"},{"startLine":20,"startCharacter":38,"endLine":344,"endCharacter":3},{"startLine":22,"startCharacter":43,"endLine":271,"endCharacter":4},{"startLine":24,"startCharacter":7,"endLine":34,"endCharacter":49},{"startLine":37,"startCharacter":21,"endLine":68,"endCharacter":56},{"startLine":52,"startCharacter":33,"endLine":64,"endCharacter":5},{"startLine":54,"startCharacter":56,"endLine":59,"endCharacter":42},{"startLine":62,"startCharacter":45,"endLine":63,"endCharacter":56},{"startLine":71,"startCharacter":20,"endLine":73,"endCharacter":43},{"startLine":77,"startCharacter":52,"endLine":93,"endCharacter":43},{"startLine":81,"startCharacter":57,"endLine":87,"endCharacter":46},{"startLine":83,"startCharacter":41,"endLine":84,"endCharacter":17},{"startLine":96,"startCharacter":45,"endLine":145,"endCharacter":5},{"startLine":97,"startCharacter":69,"endLine":120,"endCharacter":51},{"startLine":117,"startCharacter":67,"endLine":118,"endCharacter":81},{"startLine":123,"startCharacter":96,"endLine":125,"endCharacter":42},{"startLine":128,"startCharacter":77,"endLine":130,"endCharacter":46},{"startLine":133,"startCharacter":41,"endLine":144,"endCharacter":32},{"startLine":149,"startCharacter":35,"endLine":210,"endCharacter":5},{"startLine":150,"startCharacter":76,"endLine":184,"endCharacter":53},{"startLine":152,"startCharacter":49,"endLine":153,"endCharacter":44},{"startLine":174,"startCharacter":66,"endLine":179,"endCharacter":68},{"startLine":176,"startCharacter":68,"endLine":177,"endCharacter":82},{"startLine":187,"startCharacter":44,"endLine":189,"endCharacter":27},{"startLine":192,"startCharacter":42,"endLine":200,"endCharacter":27},{"startLine":203,"startCharacter":66,"endLine":209,"endCharacter":104},{"startLine":214,"startCharacter":37,"endLine":269,"endCharacter":5},{"startLine":216,"startCharacter":64,"endLine":219,"endCharacter":30},{"startLine":222,"startCharacter":116,"endLine":226,"endCharacter":27},{"startLine":229,"startCharacter":43,"endLine":268,"endCharacter":6},{"startLine":232,"startCharacter":23,"endLine":246,"endCharacter":6},{"startLine":233,"startCharacter":49,"endLine":239,"endCharacter":14},{"startLine":234,"startCharacter":20,"endLine":237,"endCharacter":28},{"startLine":243,"startCharacter":28,"endLine":245,"endCharacter":23},{"startLine":249,"startCharacter":69,"endLine":267,"endCharacter":45},{"startLine":275,"startCharacter":35,"endLine":301,"endCharacter":4},{"startLine":276,"startCharacter":52,"endLine":300,"endCharacter":34},{"startLine":278,"startCharacter":34,"endLine":285,"endCharacter":5},{"startLine":280,"startCharacter":56,"endLine":284,"endCharacter":52},{"startLine":304,"startCharacter":58,"endLine":343,"endCharacter":4},{"startLine":305,"startCharacter":50,"endLine":342,"endCharacter":6},{"startLine":328,"startCharacter":48,"endLine":341,"endCharacter":5},{"startLine":330,"startCharacter":56,"endLine":335,"endCharacter":31},{"startLine":331,"startCharacter":15,"endLine":333,"endCharacter":26},{"startLine":337,"startCharacter":45,"endLine":340,"endCharacter":32},{"startLine":349,"startCharacter":41,"endLine":363,"endCharacter":11},{"startLine":350,"startCharacter":16,"endLine":351,"endCharacter":12}]


[Trace - 15:20:52.482 PM] Received response 'textDocument/codeLens - (208)' in 450ms.
Result: null


[Trace - 15:20:52.683 PM] Sending notification '$/cancelRequest'.
Params: {"id":210}


[Trace - 15:20:52.835 PM] Sending request 'textDocument/hover - (211)'.
Params: {"textDocument":{"uri":"file:///Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go"},"position":{"line":25,"character":11}}


[Error - Received] 15:20:52.936 PM #209 <nil>: packages.Load error


[Error - Received] 15:20:52.936 PM #210 JSON RPC cancelled


[Trace - 15:20:52.937 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2020/08/27 15:20:52 go/packages.Load\n\tsnapshot=21\n\tdirectory=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT\n\tquery=[file=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go]\n\tpackages=0\n"}


[Error - 3:20:52 PM] Request textDocument/codeAction failed.
  Message: <nil>: packages.Load error
  Code: 0 
[Info  - 3:20:52 PM] 2020/08/27 15:20:52 go/packages.Load
	snapshot=21
	directory=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT
	query=[file=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go]
	packages=0

[Trace - 15:20:53.369 PM] Received response 'textDocument/hover - (211)' in 533ms.
Result: null


[Trace - 15:20:53.369 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2020/08/27 15:20:53 go/packages.Load\n\tsnapshot=21\n\tdirectory=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT\n\tquery=[file=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go]\n\tpackages=0\n"}


[Info  - 3:20:53 PM] 2020/08/27 15:20:53 go/packages.Load
	snapshot=21
	directory=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT
	query=[file=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go]
	packages=0

[Trace - 15:20:54.439 PM] Sending request 'textDocument/hover - (212)'.
Params: {"textDocument":{"uri":"file:///Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go"},"position":{"line":22,"character":3}}


[Trace - 15:20:54.697 PM] Sending notification '$/cancelRequest'.
Params: {"id":212}


[Error - Received] 15:20:54.700 PM #212 JSON RPC cancelled

When I right click on a symbol defined in an external package (outside of the project repository) in *_test.go file, I see "No definition found for ..." any symbol in the VSCode editor. The traces for gopls server RPC trace errors are below.

[Trace - 15:27:34.817 PM] Sending request 'textDocument/hover - (234)'.
Params: {"textDocument":{"uri":"file:///Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go"},"position":{"line":41,"character":13}}


[Trace - 15:27:35.276 PM] Received response 'textDocument/hover - (234)' in 458ms.
Result: null


[Trace - 15:27:35.276 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2020/08/27 15:27:35 go/packages.Load\n\tsnapshot=21\n\tdirectory=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT\n\tquery=[file=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go]\n\tpackages=0\n"}


[Info  - 3:27:35 PM] 2020/08/27 15:27:35 go/packages.Load
	snapshot=21
	directory=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT
	query=[file=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go]
	packages=0

[Trace - 15:27:35.363 PM] Sending request 'textDocument/definition - (235)'.
Params: {"textDocument":{"uri":"file:///Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go"},"position":{"line":41,"character":14}}


[Trace - 15:27:35.465 PM] Sending request 'textDocument/hover - (236)'.
Params: {"textDocument":{"uri":"file:///Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go"},"position":{"line":41,"character":13}}


[Error - Received] 15:27:35.789 PM #235 getting file for Identifier: <nil>: packages.Load error


[Trace - 15:27:35.789 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2020/08/27 15:27:35 go/packages.Load\n\tsnapshot=21\n\tdirectory=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT\n\tquery=[file=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go]\n\tpackages=0\n"}


[Error - 3:27:35 PM] Request textDocument/definition failed.
  Message: getting file for Identifier: <nil>: packages.Load error
  Code: 0 
[Info  - 3:27:35 PM] 2020/08/27 15:27:35 go/packages.Load
	snapshot=21
	directory=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT
	query=[file=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go]
	packages=0

[Trace - 15:27:35.893 PM] Sending request 'textDocument/documentHighlight - (237)'.
Params: {"textDocument":{"uri":"file:///Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go"},"position":{"line":41,"character":14}}


[Trace - 15:27:35.893 PM] Sending notification '$/cancelRequest'.
Params: {"id":236}


[Error - Received] 15:27:35.896 PM #236 JSON RPC cancelled


[Trace - 15:27:36.024 PM] Sending request 'textDocument/definition - (238)'.
Params: {"textDocument":{"uri":"file:///Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go"},"position":{"line":41,"character":14}}


[Trace - 15:27:36.121 PM] Sending request 'textDocument/codeAction - (239)'.
Params: {"textDocument":{"uri":"file:///Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go"},"range":{"start":{"line":41,"character":14},"end":{"line":41,"character":14}},"context":{"diagnostics":[]}}


[Trace - 15:27:36.369 PM] Received response 'textDocument/documentHighlight - (237)' in 476ms.
Result: []


[Trace - 15:27:36.369 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2020/08/27 15:27:36 go/packages.Load\n\tsnapshot=21\n\tdirectory=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT\n\tquery=[file=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go]\n\tpackages=0\n"}


[Trace - 15:27:36.369 PM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2020/08/27 15:27:36 no highlight: getting file for Highlight: \u003cnil\u003e: packages.Load error\n\tURI=file:///Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go\n"}


[Info  - 3:27:36 PM] 2020/08/27 15:27:36 go/packages.Load
	snapshot=21
	directory=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT
	query=[file=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go]
	packages=0

[Error - 3:27:36 PM] 2020/08/27 15:27:36 no highlight: getting file for Highlight: <nil>: packages.Load error
	URI=file:///Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go

[Error - Received] 15:27:36.808 PM #238 getting file for Identifier: <nil>: packages.Load error


[Trace - 15:27:36.808 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2020/08/27 15:27:36 go/packages.Load\n\tsnapshot=21\n\tdirectory=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT\n\tquery=[file=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go]\n\tpackages=0\n"}


[Error - 3:27:36 PM] Request textDocument/definition failed.
  Message: getting file for Identifier: <nil>: packages.Load error
  Code: 0 
[Info  - 3:27:36 PM] 2020/08/27 15:27:36 go/packages.Load
	snapshot=21
	directory=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT
	query=[file=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go]
	packages=0

[Error - Received] 15:27:37.248 PM #239 <nil>: packages.Load error


[Trace - 15:27:37.249 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2020/08/27 15:27:37 go/packages.Load\n\tsnapshot=21\n\tdirectory=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT\n\tquery=[file=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go]\n\tpackages=0\n"}


[Error - 3:27:37 PM] Request textDocument/codeAction failed.
  Message: <nil>: packages.Load error
  Code: 0 
[Info  - 3:27:37 PM] 2020/08/27 15:27:37 go/packages.Load
	snapshot=21
	directory=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT
	query=[file=/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go]
	packages=0

Here gopls check does return an error

$ gopls check /Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go

2020/08/27 16:28:31 Error:2020/08/27 16:28:31 reloadOrphanedFiles: failed to load: <nil>: packages.Load error
	query=[file:///Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/db_test.go]

Finally, this may be a separate issue but just in case it helps as context -- I seem get this error as a popup from the VSCode Go extension/gopls when I add a new package in my source code and save. Example:

The code in the workspace failed to compile (see the error message below). If you believe this is a mistake, please file an issue: https://github.com/golang/go/issues/new. $MY_PROJECT/internal/routing [$MY_PROJECT/internal/routing.test] has no metadata

Thanks in advance!

@gopherbot gopherbot added this to the Unreleased milestone Aug 27, 2020
@dylankb dylankb changed the title x/tools/gopls: Loading, command errors in VSCode not working for imported library code in *_test.go files x/tools/gopls: Loading, command errors in VSCode for *_test.go files Aug 27, 2020
@dylankb dylankb changed the title x/tools/gopls: Loading, command errors in VSCode for *_test.go files x/tools/gopls: Loading, command errors in VSCode, CLI for *_test.go files Aug 27, 2020
@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Aug 28, 2020

The second issue you mention is #40690.

The issue with your test file is that gopls can't seem to load any package for it - does it contain build tags by any chance? What is the output of go list -e -json -test ./... when you are in the /Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/ directory?

@stamblerre stamblerre modified the milestones: Unreleased, gopls/v0.5.0 Aug 28, 2020
@stamblerre stamblerre changed the title x/tools/gopls: Loading, command errors in VSCode, CLI for *_test.go files x/tools/gopls: fails to load package for test file Aug 28, 2020
@dylankb
Copy link
Author

@dylankb dylankb commented Aug 28, 2020

Yes, the test files do use build tags. Should build tags be handled in gopls settings?. Here's the output you requested.

The issue with your test file is that gopls can't seem to load any package for it

Perhaps it's a problem that these files show up as IgnoredGoFiles?

$ cd  internal/db && go list -e -json -test ./...
{
	"Dir": "/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db",
	"ImportPath": "$MY_PROJECT/internal/db",
	"Name": "db",
	"Target": "/Users/dbarnard/Code/go/pkg/darwin_amd64/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db.a",
	"Root": "/Users/dbarnard/Code/go",
	"Module": {
		"Path": "$MY_PROJECT",
		"Main": true,
		"Dir": "/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT",
		"GoMod": "/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/go.mod",
		"GoVersion": "1.14"
	},
	"Match": [
		"./..."
	],
	"Stale": true,
	"StaleReason": "not installed but available in build cache",
	"GoFiles": [
		"db.go"
	],
	"IgnoredGoFiles": [
		"db_integration_test.go",
		"db_suite_test.go",
		"db_test.go"
	],
	"Imports": [
		"$MY_PRIVATE_REPO/libraries/go-observation/logging",
		"$MY_PRIVATE_REPO/libraries/go-sql/sqlx",
		"context",
		"database/sql",
		"encoding/json",
		"errors",
		"fmt",
		"gopkg.in/yaml.v2",
		"$MY_PROJECT/internal/db/sqlxdb",
		"strings"
	],
	"Deps": [
		"bufio",
		"bytes",
		"$MY_PRIVATE_REPO/libraries/go-observation/internal",
		"$MY_PRIVATE_REPO/libraries/go-observation/logging",
		"$MY_PRIVATE_REPO/libraries/go-observation/tracing",
		"$MY_PRIVATE_REPO/libraries/go-sql/secrets",
		"$MY_PRIVATE_REPO/libraries/go-sql/sqlx",
		"compress/flate",
		"compress/gzip",
		"container/list",
		"context",
		"crypto",
		"crypto/aes",
		"crypto/cipher",
		"crypto/des",
		"crypto/dsa",
		"crypto/ecdsa",
		"crypto/ed25519",
		"crypto/ed25519/internal/edwards25519",
		"crypto/elliptic",
		"crypto/hmac",
		"crypto/internal/randutil",
		"crypto/internal/subtle",
		"crypto/md5",
		"crypto/rand",
		"crypto/rc4",
		"crypto/rsa",
		"crypto/sha1",
		"crypto/sha256",
		"crypto/sha512",
		"crypto/subtle",
		"crypto/tls",
		"crypto/x509",
		"crypto/x509/pkix",
		"database/sql",
		"database/sql/driver",
		"encoding",
		"encoding/asn1",
		"encoding/base64",
		"encoding/binary",
		"encoding/hex",
		"encoding/json",
		"encoding/pem",
		"encoding/xml",
		"errors",
		"expvar",
		"flag",
		"fmt",
		"github.com/aws/aws-sdk-go/aws",
		"github.com/aws/aws-sdk-go/aws/awserr",
		"github.com/aws/aws-sdk-go/aws/awsutil",
		"github.com/aws/aws-sdk-go/aws/client",
		"github.com/aws/aws-sdk-go/aws/client/metadata",
		"github.com/aws/aws-sdk-go/aws/corehandlers",
		"github.com/aws/aws-sdk-go/aws/credentials",
		"github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds",
		"github.com/aws/aws-sdk-go/aws/credentials/endpointcreds",
		"github.com/aws/aws-sdk-go/aws/credentials/processcreds",
		"github.com/aws/aws-sdk-go/aws/credentials/stscreds",
		"github.com/aws/aws-sdk-go/aws/csm",
		"github.com/aws/aws-sdk-go/aws/defaults",
		"github.com/aws/aws-sdk-go/aws/ec2metadata",
		"github.com/aws/aws-sdk-go/aws/endpoints",
		"github.com/aws/aws-sdk-go/aws/request",
		"github.com/aws/aws-sdk-go/aws/session",
		"github.com/aws/aws-sdk-go/aws/signer/v4",
		"github.com/aws/aws-sdk-go/internal/ini",
		"github.com/aws/aws-sdk-go/internal/sdkio",
		"github.com/aws/aws-sdk-go/internal/sdkmath",
		"github.com/aws/aws-sdk-go/internal/sdkrand",
		"github.com/aws/aws-sdk-go/internal/sdkuri",
		"github.com/aws/aws-sdk-go/internal/shareddefaults",
		"github.com/aws/aws-sdk-go/internal/strings",
		"github.com/aws/aws-sdk-go/internal/sync/singleflight",
		"github.com/aws/aws-sdk-go/private/protocol",
		"github.com/aws/aws-sdk-go/private/protocol/json/jsonutil",
		"github.com/aws/aws-sdk-go/private/protocol/jsonrpc",
		"github.com/aws/aws-sdk-go/private/protocol/query",
		"github.com/aws/aws-sdk-go/private/protocol/query/queryutil",
		"github.com/aws/aws-sdk-go/private/protocol/rest",
		"github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil",
		"github.com/aws/aws-sdk-go/service/rds",
		"github.com/aws/aws-sdk-go/service/rds/rdsutils",
		"github.com/aws/aws-sdk-go/service/secretsmanager",
		"github.com/aws/aws-sdk-go/service/sts",
		"github.com/aws/aws-sdk-go/service/sts/stsiface",
		"github.com/beorn7/perks/quantile",
		"github.com/cespare/xxhash/v2",
		"github.com/golang/protobuf/proto",
		"github.com/golang/protobuf/ptypes",
		"github.com/golang/protobuf/ptypes/any",
		"github.com/golang/protobuf/ptypes/duration",
		"github.com/golang/protobuf/ptypes/timestamp",
		"github.com/jmespath/go-jmespath",
		"github.com/lib/pq",
		"github.com/lib/pq/oid",
		"github.com/lib/pq/scram",
		"github.com/matttproud/golang_protobuf_extensions/pbutil",
		"github.com/opentracing-contrib/go-stdlib/nethttp",
		"github.com/opentracing/opentracing-go",
		"github.com/opentracing/opentracing-go/ext",
		"github.com/opentracing/opentracing-go/log",
		"github.com/prometheus/client_golang/prometheus",
		"github.com/prometheus/client_golang/prometheus/internal",
		"github.com/prometheus/client_model/go",
		"github.com/prometheus/common/expfmt",
		"github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg",
		"github.com/prometheus/common/model",
		"github.com/prometheus/procfs",
		"github.com/prometheus/procfs/internal/fs",
		"github.com/prometheus/procfs/internal/util",
		"github.com/sebest/xff",
		"go.uber.org/atomic",
		"go.uber.org/multierr",
		"go.uber.org/zap",
		"go.uber.org/zap/buffer",
		"go.uber.org/zap/internal/bufferpool",
		"go.uber.org/zap/internal/color",
		"go.uber.org/zap/internal/exit",
		"go.uber.org/zap/zapcore",
		"go/token",
		"golang.org/x/crypto/pbkdf2",
		"golang.org/x/net/http/httpguts",
		"golang.org/x/net/http2",
		"golang.org/x/net/http2/hpack",
		"golang.org/x/net/idna",
		"golang.org/x/net/internal/timeseries",
		"golang.org/x/net/trace",
		"golang.org/x/sys/internal/unsafeheader",
		"golang.org/x/sys/unix",
		"golang.org/x/text/secure/bidirule",
		"golang.org/x/text/transform",
		"golang.org/x/text/unicode/bidi",
		"golang.org/x/text/unicode/norm",
		"google.golang.org/genproto/googleapis/rpc/status",
		"google.golang.org/grpc",
		"google.golang.org/grpc/attributes",
		"google.golang.org/grpc/backoff",
		"google.golang.org/grpc/balancer",
		"google.golang.org/grpc/balancer/base",
		"google.golang.org/grpc/balancer/roundrobin",
		"google.golang.org/grpc/binarylog/grpc_binarylog_v1",
		"google.golang.org/grpc/codes",
		"google.golang.org/grpc/connectivity",
		"google.golang.org/grpc/credentials",
		"google.golang.org/grpc/credentials/internal",
		"google.golang.org/grpc/encoding",
		"google.golang.org/grpc/encoding/proto",
		"google.golang.org/grpc/grpclog",
		"google.golang.org/grpc/internal",
		"google.golang.org/grpc/internal/backoff",
		"google.golang.org/grpc/internal/balancerload",
		"google.golang.org/grpc/internal/binarylog",
		"google.golang.org/grpc/internal/buffer",
		"google.golang.org/grpc/internal/channelz",
		"google.golang.org/grpc/internal/envconfig",
		"google.golang.org/grpc/internal/grpclog",
		"google.golang.org/grpc/internal/grpcrand",
		"google.golang.org/grpc/internal/grpcsync",
		"google.golang.org/grpc/internal/grpcutil",
		"google.golang.org/grpc/internal/resolver/dns",
		"google.golang.org/grpc/internal/resolver/passthrough",
		"google.golang.org/grpc/internal/status",
		"google.golang.org/grpc/internal/syscall",
		"google.golang.org/grpc/internal/transport",
		"google.golang.org/grpc/keepalive",
		"google.golang.org/grpc/metadata",
		"google.golang.org/grpc/naming",
		"google.golang.org/grpc/peer",
		"google.golang.org/grpc/resolver",
		"google.golang.org/grpc/serviceconfig",
		"google.golang.org/grpc/stats",
		"google.golang.org/grpc/status",
		"google.golang.org/grpc/tap",
		"google.golang.org/protobuf/encoding/prototext",
		"google.golang.org/protobuf/encoding/protowire",
		"google.golang.org/protobuf/internal/descfmt",
		"google.golang.org/protobuf/internal/descopts",
		"google.golang.org/protobuf/internal/detrand",
		"google.golang.org/protobuf/internal/encoding/defval",
		"google.golang.org/protobuf/internal/encoding/messageset",
		"google.golang.org/protobuf/internal/encoding/tag",
		"google.golang.org/protobuf/internal/encoding/text",
		"google.golang.org/protobuf/internal/errors",
		"google.golang.org/protobuf/internal/fieldnum",
		"google.golang.org/protobuf/internal/fieldsort",
		"google.golang.org/protobuf/internal/filedesc",
		"google.golang.org/protobuf/internal/filetype",
		"google.golang.org/protobuf/internal/flags",
		"google.golang.org/protobuf/internal/genname",
		"google.golang.org/protobuf/internal/impl",
		"google.golang.org/protobuf/internal/mapsort",
		"google.golang.org/protobuf/internal/pragma",
		"google.golang.org/protobuf/internal/set",
		"google.golang.org/protobuf/internal/strs",
		"google.golang.org/protobuf/internal/version",
		"google.golang.org/protobuf/proto",
		"google.golang.org/protobuf/reflect/protoreflect",
		"google.golang.org/protobuf/reflect/protoregistry",
		"google.golang.org/protobuf/runtime/protoiface",
		"google.golang.org/protobuf/runtime/protoimpl",
		"google.golang.org/protobuf/types/known/anypb",
		"google.golang.org/protobuf/types/known/durationpb",
		"google.golang.org/protobuf/types/known/timestamppb",
		"gopkg.in/mgo.v2/bson",
		"gopkg.in/mgo.v2/internal/json",
		"gopkg.in/yaml.v2",
		"hash",
		"hash/crc32",
		"hash/fnv",
		"html",
		"html/template",
		"internal/bytealg",
		"internal/cpu",
		"internal/fmtsort",
		"internal/nettrace",
		"internal/oserror",
		"internal/poll",
		"internal/race",
		"internal/reflectlite",
		"internal/singleflight",
		"internal/syscall/execenv",
		"internal/syscall/unix",
		"internal/testlog",
		"io",
		"io/ioutil",
		"log",
		"math",
		"math/big",
		"math/bits",
		"math/rand",
		"$MY_PROJECT/internal/db/sqlxdb",
		"mime",
		"mime/multipart",
		"mime/quotedprintable",
		"net",
		"net/http",
		"net/http/httptrace",
		"net/http/httputil",
		"net/http/internal",
		"net/textproto",
		"net/url",
		"os",
		"os/exec",
		"os/user",
		"path",
		"path/filepath",
		"reflect",
		"regexp",
		"regexp/syntax",
		"runtime",
		"runtime/cgo",
		"runtime/debug",
		"runtime/internal/atomic",
		"runtime/internal/math",
		"runtime/internal/sys",
		"sort",
		"strconv",
		"strings",
		"sync",
		"sync/atomic",
		"syscall",
		"text/tabwriter",
		"text/template",
		"text/template/parse",
		"time",
		"unicode",
		"unicode/utf16",
		"unicode/utf8",
		"unsafe",
		"vendor/golang.org/x/crypto/chacha20",
		"vendor/golang.org/x/crypto/chacha20poly1305",
		"vendor/golang.org/x/crypto/cryptobyte",
		"vendor/golang.org/x/crypto/cryptobyte/asn1",
		"vendor/golang.org/x/crypto/curve25519",
		"vendor/golang.org/x/crypto/hkdf",
		"vendor/golang.org/x/crypto/internal/subtle",
		"vendor/golang.org/x/crypto/poly1305",
		"vendor/golang.org/x/net/dns/dnsmessage",
		"vendor/golang.org/x/net/http/httpguts",
		"vendor/golang.org/x/net/http/httpproxy",
		"vendor/golang.org/x/net/http2/hpack",
		"vendor/golang.org/x/net/idna",
		"vendor/golang.org/x/net/route",
		"vendor/golang.org/x/sys/cpu",
		"vendor/golang.org/x/text/secure/bidirule",
		"vendor/golang.org/x/text/transform",
		"vendor/golang.org/x/text/unicode/bidi",
		"vendor/golang.org/x/text/unicode/norm"
	]
}
{
	"Dir": "/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/sqlxdb",
	"ImportPath": "$MY_PROJECT/internal/db/sqlxdb",
	"Name": "sqlxdb",
	"Target": "/Users/dbarnard/Code/go/pkg/darwin_amd64/$MY_PRIVATE_REPO/$MY_PROJECT/internal/db/sqlxdb.a",
	"Root": "/Users/dbarnard/Code/go",
	"Module": {
		"Path": "$MY_PROJECT",
		"Main": true,
		"Dir": "/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT",
		"GoMod": "/Users/dbarnard/Code/go/src/$MY_PRIVATE_REPO/$MY_PROJECT/go.mod",
		"GoVersion": "1.14"
	},
	"Match": [
		"./..."
	],
	"Stale": true,
	"StaleReason": "not installed but available in build cache",
	"GoFiles": [
		"sqlxdb.go"
	],
	"Imports": [
		"$MY_PRIVATE_REPO/libraries/go-observation/logging",
		"$MY_PRIVATE_REPO/libraries/go-sql/secrets",
		"$MY_PRIVATE_REPO/libraries/go-sql/sqlx",
		"context",
		"database/sql",
		"github.com/aws/aws-sdk-go/aws/credentials",
		"github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds",
		"github.com/aws/aws-sdk-go/aws/ec2metadata",
		"github.com/aws/aws-sdk-go/aws/session",
		"os",
		"time"
	],
	"Deps": [
		"bufio",
		"bytes",
		"$MY_PRIVATE_REPO/libraries/go-observation/internal",
		"$MY_PRIVATE_REPO/libraries/go-observation/logging",
		"$MY_PRIVATE_REPO/libraries/go-observation/tracing",
		"$MY_PRIVATE_REPO/libraries/go-sql/secrets",
		"$MY_PRIVATE_REPO/libraries/go-sql/sqlx",
		"compress/flate",
		"compress/gzip",
		"container/list",
		"context",
		"crypto",
		"crypto/aes",
		"crypto/cipher",
		"crypto/des",
		"crypto/dsa",
		"crypto/ecdsa",
		"crypto/ed25519",
		"crypto/ed25519/internal/edwards25519",
		"crypto/elliptic",
		"crypto/hmac",
		"crypto/internal/randutil",
		"crypto/internal/subtle",
		"crypto/md5",
		"crypto/rand",
		"crypto/rc4",
		"crypto/rsa",
		"crypto/sha1",
		"crypto/sha256",
		"crypto/sha512",
		"crypto/subtle",
		"crypto/tls",
		"crypto/x509",
		"crypto/x509/pkix",
		"database/sql",
		"database/sql/driver",
		"encoding",
		"encoding/asn1",
		"encoding/base64",
		"encoding/binary",
		"encoding/hex",
		"encoding/json",
		"encoding/pem",
		"encoding/xml",
		"errors",
		"expvar",
		"flag",
		"fmt",
		"github.com/aws/aws-sdk-go/aws",
		"github.com/aws/aws-sdk-go/aws/awserr",
		"github.com/aws/aws-sdk-go/aws/awsutil",
		"github.com/aws/aws-sdk-go/aws/client",
		"github.com/aws/aws-sdk-go/aws/client/metadata",
		"github.com/aws/aws-sdk-go/aws/corehandlers",
		"github.com/aws/aws-sdk-go/aws/credentials",
		"github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds",
		"github.com/aws/aws-sdk-go/aws/credentials/endpointcreds",
		"github.com/aws/aws-sdk-go/aws/credentials/processcreds",
		"github.com/aws/aws-sdk-go/aws/credentials/stscreds",
		"github.com/aws/aws-sdk-go/aws/csm",
		"github.com/aws/aws-sdk-go/aws/defaults",
		"github.com/aws/aws-sdk-go/aws/ec2metadata",
		"github.com/aws/aws-sdk-go/aws/endpoints",
		"github.com/aws/aws-sdk-go/aws/request",
		"github.com/aws/aws-sdk-go/aws/session",
		"github.com/aws/aws-sdk-go/aws/signer/v4",
		"github.com/aws/aws-sdk-go/internal/ini",
		"github.com/aws/aws-sdk-go/internal/sdkio",
		"github.com/aws/aws-sdk-go/internal/sdkmath",
		"github.com/aws/aws-sdk-go/internal/sdkrand",
		"github.com/aws/aws-sdk-go/internal/sdkuri",
		"github.com/aws/aws-sdk-go/internal/shareddefaults",
		"github.com/aws/aws-sdk-go/internal/strings",
		"github.com/aws/aws-sdk-go/internal/sync/singleflight",
		"github.com/aws/aws-sdk-go/private/protocol",
		"github.com/aws/aws-sdk-go/private/protocol/json/jsonutil",
		"github.com/aws/aws-sdk-go/private/protocol/jsonrpc",
		"github.com/aws/aws-sdk-go/private/protocol/query",
		"github.com/aws/aws-sdk-go/private/protocol/query/queryutil",
		"github.com/aws/aws-sdk-go/private/protocol/rest",
		"github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil",
		"github.com/aws/aws-sdk-go/service/rds",
		"github.com/aws/aws-sdk-go/service/rds/rdsutils",
		"github.com/aws/aws-sdk-go/service/secretsmanager",
		"github.com/aws/aws-sdk-go/service/sts",
		"github.com/aws/aws-sdk-go/service/sts/stsiface",
		"github.com/beorn7/perks/quantile",
		"github.com/cespare/xxhash/v2",
		"github.com/golang/protobuf/proto",
		"github.com/golang/protobuf/ptypes",
		"github.com/golang/protobuf/ptypes/any",
		"github.com/golang/protobuf/ptypes/duration",
		"github.com/golang/protobuf/ptypes/timestamp",
		"github.com/jmespath/go-jmespath",
		"github.com/lib/pq",
		"github.com/lib/pq/oid",
		"github.com/lib/pq/scram",
		"github.com/matttproud/golang_protobuf_extensions/pbutil",
		"github.com/opentracing-contrib/go-stdlib/nethttp",
		"github.com/opentracing/opentracing-go",
		"github.com/opentracing/opentracing-go/ext",
		"github.com/opentracing/opentracing-go/log",
		"github.com/prometheus/client_golang/prometheus",
		"github.com/prometheus/client_golang/prometheus/internal",
		"github.com/prometheus/client_model/go",
		"github.com/prometheus/common/expfmt",
		"github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg",
		"github.com/prometheus/common/model",
		"github.com/prometheus/procfs",
		"github.com/prometheus/procfs/internal/fs",
		"github.com/prometheus/procfs/internal/util",
		"github.com/sebest/xff",
		"go.uber.org/atomic",
		"go.uber.org/multierr",
		"go.uber.org/zap",
		"go.uber.org/zap/buffer",
		"go.uber.org/zap/internal/bufferpool",
		"go.uber.org/zap/internal/color",
		"go.uber.org/zap/internal/exit",
		"go.uber.org/zap/zapcore",
		"go/token",
		"golang.org/x/crypto/pbkdf2",
		"golang.org/x/net/http/httpguts",
		"golang.org/x/net/http2",
		"golang.org/x/net/http2/hpack",
		"golang.org/x/net/idna",
		"golang.org/x/net/internal/timeseries",
		"golang.org/x/net/trace",
		"golang.org/x/sys/internal/unsafeheader",
		"golang.org/x/sys/unix",
		"golang.org/x/text/secure/bidirule",
		"golang.org/x/text/transform",
		"golang.org/x/text/unicode/bidi",
		"golang.org/x/text/unicode/norm",
		"google.golang.org/genproto/googleapis/rpc/status",
		"google.golang.org/grpc",
		"google.golang.org/grpc/attributes",
		"google.golang.org/grpc/backoff",
		"google.golang.org/grpc/balancer",
		"google.golang.org/grpc/balancer/base",
		"google.golang.org/grpc/balancer/roundrobin",
		"google.golang.org/grpc/binarylog/grpc_binarylog_v1",
		"google.golang.org/grpc/codes",
		"google.golang.org/grpc/connectivity",
		"google.golang.org/grpc/credentials",
		"google.golang.org/grpc/credentials/internal",
		"google.golang.org/grpc/encoding",
		"google.golang.org/grpc/encoding/proto",
		"google.golang.org/grpc/grpclog",
		"google.golang.org/grpc/internal",
		"google.golang.org/grpc/internal/backoff",
		"google.golang.org/grpc/internal/balancerload",
		"google.golang.org/grpc/internal/binarylog",
		"google.golang.org/grpc/internal/buffer",
		"google.golang.org/grpc/internal/channelz",
		"google.golang.org/grpc/internal/envconfig",
		"google.golang.org/grpc/internal/grpclog",
		"google.golang.org/grpc/internal/grpcrand",
		"google.golang.org/grpc/internal/grpcsync",
		"google.golang.org/grpc/internal/grpcutil",
		"google.golang.org/grpc/internal/resolver/dns",
		"google.golang.org/grpc/internal/resolver/passthrough",
		"google.golang.org/grpc/internal/status",
		"google.golang.org/grpc/internal/syscall",
		"google.golang.org/grpc/internal/transport",
		"google.golang.org/grpc/keepalive",
		"google.golang.org/grpc/metadata",
		"google.golang.org/grpc/naming",
		"google.golang.org/grpc/peer",
		"google.golang.org/grpc/resolver",
		"google.golang.org/grpc/serviceconfig",
		"google.golang.org/grpc/stats",
		"google.golang.org/grpc/status",
		"google.golang.org/grpc/tap",
		"google.golang.org/protobuf/encoding/prototext",
		"google.golang.org/protobuf/encoding/protowire",
		"google.golang.org/protobuf/internal/descfmt",
		"google.golang.org/protobuf/internal/descopts",
		"google.golang.org/protobuf/internal/detrand",
		"google.golang.org/protobuf/internal/encoding/defval",
		"google.golang.org/protobuf/internal/encoding/messageset",
		"google.golang.org/protobuf/internal/encoding/tag",
		"google.golang.org/protobuf/internal/encoding/text",
		"google.golang.org/protobuf/internal/errors",
		"google.golang.org/protobuf/internal/fieldnum",
		"google.golang.org/protobuf/internal/fieldsort",
		"google.golang.org/protobuf/internal/filedesc",
		"google.golang.org/protobuf/internal/filetype",
		"google.golang.org/protobuf/internal/flags",
		"google.golang.org/protobuf/internal/genname",
		"google.golang.org/protobuf/internal/impl",
		"google.golang.org/protobuf/internal/mapsort",
		"google.golang.org/protobuf/internal/pragma",
		"google.golang.org/protobuf/internal/set",
		"google.golang.org/protobuf/internal/strs",
		"google.golang.org/protobuf/internal/version",
		"google.golang.org/protobuf/proto",
		"google.golang.org/protobuf/reflect/protoreflect",
		"google.golang.org/protobuf/reflect/protoregistry",
		"google.golang.org/protobuf/runtime/protoiface",
		"google.golang.org/protobuf/runtime/protoimpl",
		"google.golang.org/protobuf/types/known/anypb",
		"google.golang.org/protobuf/types/known/durationpb",
		"google.golang.org/protobuf/types/known/timestamppb",
		"gopkg.in/mgo.v2/bson",
		"gopkg.in/mgo.v2/internal/json",
		"hash",
		"hash/crc32",
		"hash/fnv",
		"html",
		"html/template",
		"internal/bytealg",
		"internal/cpu",
		"internal/fmtsort",
		"internal/nettrace",
		"internal/oserror",
		"internal/poll",
		"internal/race",
		"internal/reflectlite",
		"internal/singleflight",
		"internal/syscall/execenv",
		"internal/syscall/unix",
		"internal/testlog",
		"io",
		"io/ioutil",
		"log",
		"math",
		"math/big",
		"math/bits",
		"math/rand",
		"mime",
		"mime/multipart",
		"mime/quotedprintable",
		"net",
		"net/http",
		"net/http/httptrace",
		"net/http/httputil",
		"net/http/internal",
		"net/textproto",
		"net/url",
		"os",
		"os/exec",
		"os/user",
		"path",
		"path/filepath",
		"reflect",
		"regexp",
		"regexp/syntax",
		"runtime",
		"runtime/cgo",
		"runtime/debug",
		"runtime/internal/atomic",
		"runtime/internal/math",
		"runtime/internal/sys",
		"sort",
		"strconv",
		"strings",
		"sync",
		"sync/atomic",
		"syscall",
		"text/tabwriter",
		"text/template",
		"text/template/parse",
		"time",
		"unicode",
		"unicode/utf16",
		"unicode/utf8",
		"unsafe",
		"vendor/golang.org/x/crypto/chacha20",
		"vendor/golang.org/x/crypto/chacha20poly1305",
		"vendor/golang.org/x/crypto/cryptobyte",
		"vendor/golang.org/x/crypto/cryptobyte/asn1",
		"vendor/golang.org/x/crypto/curve25519",
		"vendor/golang.org/x/crypto/hkdf",
		"vendor/golang.org/x/crypto/internal/subtle",
		"vendor/golang.org/x/crypto/poly1305",
		"vendor/golang.org/x/net/dns/dnsmessage",
		"vendor/golang.org/x/net/http/httpguts",
		"vendor/golang.org/x/net/http/httpproxy",
		"vendor/golang.org/x/net/http2/hpack",
		"vendor/golang.org/x/net/idna",
		"vendor/golang.org/x/net/route",
		"vendor/golang.org/x/sys/cpu",
		"vendor/golang.org/x/text/secure/bidirule",
		"vendor/golang.org/x/text/transform",
		"vendor/golang.org/x/text/unicode/bidi",
		"vendor/golang.org/x/text/unicode/norm"
	]
}
@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Aug 28, 2020

Yes - you have to add build tags to your configuration if you are using a build tagged file.
See https://github.com/golang/tools/blob/master/gopls/doc/settings.md#buildflags-array-of-strings and #29202 for more details.

@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Aug 28, 2020

The setting you want is:

"gopls": {
    "env": {
        "GOFLAGS": "-tags=<my build tag>"
    }
}
@dylankb
Copy link
Author

@dylankb dylankb commented Aug 28, 2020

Wohoo! Totally fixes my issue. Great project, and I also loved your GopherCon talk. Keep it up!

@dylankb dylankb closed this Aug 28, 2020
@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Aug 28, 2020

Thank you! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.