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: ignore files starting with underscores #33540

Closed
VojtechVitek opened this issue Aug 8, 2019 · 7 comments
Closed

x/tools/gopls: ignore files starting with underscores #33540

VojtechVitek opened this issue Aug 8, 2019 · 7 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@VojtechVitek
Copy link

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

$ go version
go version go1.12 darwin/amd64

$ gopls version
version v0.1.3-cmd.gopls, built in $GOPATH mode

Panic report

[Info  - 1:53:26 PM] 110.550015ms for GOROOT=/usr/local/Cellar/go/1.11.5/libexec GOPATH=/Users/vojtechvitek/go GO111MODULE= PWD=/Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml go "list" "-e" "-json" "-compiled=true" "-test=true" "-export=false" "-deps=true" "-find=false" "--" "log", stderr: <<>>

packages.Load: found 1 packages
packages.Load: package github.com/VojtechVitek/yaml with files [/Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/delete.go /Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/match.go /Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/yaml.go /Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/_set.go]
[Error - 1:53:26 PM] unable to check package for file:///Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/delete.go: no packages found for file:///Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/delete.go
[Error - 1:53:26 PM] failed to deliver diagnostic for file:///Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/delete.go (will retry): GetAST: unable to check package for file:///Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/delete.go: no packages found for file:///Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/delete.go
[Error - 1:53:26 PM] failed to deliver diagnostic for file:///Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/delete.go (will not retry): GetAST: unable to check package for file:///Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/delete.go: no packages found for file:///Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/delete.go
panic: interface conversion: types.Object is nil, not *types.Func

goroutine 1908 [running]:
golang.org/x/tools/go/analysis/passes/printf.maybePrintfWrapper(0xc0024b0230, 0x1724140, 0xc001de4ed0, 0x0)
	/Users/vojtechvitek/go/src/golang.org/x/tools/go/analysis/passes/printf/printf.go:115 +0x307
golang.org/x/tools/go/analysis/passes/printf.findPrintfLike(0xc000243ae0, 0x10, 0x15c6a60, 0xc001eace01, 0xc001fe8b30)
	/Users/vojtechvitek/go/src/golang.org/x/tools/go/analysis/passes/printf/printf.go:154 +0xf2
golang.org/x/tools/go/analysis/passes/printf.run(0xc000243ae0, 0xc001fe8b00, 0xc000024300, 0xc000a4bd20, 0x4)
	/Users/vojtechvitek/go/src/golang.org/x/tools/go/analysis/passes/printf/printf.go:83 +0x2b
golang.org/x/tools/internal/lsp/source.(*Action).execOnce(0xc001a55080, 0x1725640, 0xc001d0e540, 0xc000079d00, 0xc002f5e6c8, 0x10)
	/Users/vojtechvitek/go/src/golang.org/x/tools/internal/lsp/source/analysis.go:169 +0x861
golang.org/x/tools/internal/lsp/source.(*Action).exec.func1()
	/Users/vojtechvitek/go/src/golang.org/x/tools/internal/lsp/source/analysis.go:103 +0x4e
sync.(*Once).Do(0xc001a55080, 0xc002f5e708)
	/usr/local/Cellar/go/1.11.5/libexec/src/sync/once.go:44 +0xb3
golang.org/x/tools/internal/lsp/source.(*Action).exec(0xc001a55080, 0x1725640, 0xc001d0e540, 0xc000079d00, 0xc002571bc0, 0xc002f5e790)
	/Users/vojtechvitek/go/src/golang.org/x/tools/internal/lsp/source/analysis.go:102 +0x8b
golang.org/x/tools/internal/lsp/source.execAll.func1(0x8, 0x169b6e8)
	/Users/vojtechvitek/go/src/golang.org/x/tools/internal/lsp/source/analysis.go:94 +0x48
golang.org/x/sync/errgroup.(*Group).Go.func1(0xc001c40ba0, 0xc000a4a620)
	/Users/vojtechvitek/go/src/golang.org/x/sync/errgroup/errgroup.go:57 +0x57
created by golang.org/x/sync/errgroup.(*Group).Go
	/Users/vojtechvitek/go/src/golang.org/x/sync/errgroup/errgroup.go:54 +0x66
[Error - 1:53:31 PM] Connection to server got closed. Server will not be restarted.
@gopherbot gopherbot added this to the Unreleased milestone Aug 8, 2019
@gopherbot gopherbot added the gopls Issues related to the Go language server, gopls. label Aug 8, 2019
@stamblerre
Copy link
Contributor

Does this package use build tags? This sounds like it may be a duplicate of #32413.

@stamblerre stamblerre added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Aug 8, 2019
@stamblerre stamblerre changed the title x/tools/cmd/gopls: panic in gopls server x/tools/gopls: panic in gopls server Aug 8, 2019
@VojtechVitek
Copy link
Author

@stamblerre No, there are no build tags in this project or in its dependencies (github.com/pkg/errors, gopkg.in/yaml.v3).

@stamblerre
Copy link
Contributor

Ok, thanks for confirming. What is the output of gopls -rpc.trace -v check path/to/file.go?

@VojtechVitek
Copy link
Author

$ gopls -rpc.trace -v check *.go
2019/08/11 11:05:10 Info:26.254576ms for GOROOT= GOPATH=/Users/vojtechvitek/go GO111MODULE= PWD=/Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml go "list" "-e" "-json" "-compiled=true" "-test=true" "-export=false" "-deps=true" "-find=false" "--" "builtin", stderr: <<>>
2019/08/11 11:05:10 Info:Build info
----------
version v0.1.3-cmd.gopls, built in $GOPATH mode

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/vojtechvitek/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/vojtechvitek/go"
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/x_/8kt52fyj6qb3s7hhht1c4z_00000gn/T/go-build261763569=/tmp/go-build -gno-record-gcc-switches -fno-common"
2019/08/11 11:05:10 Info:167.261027ms for GOROOT= GOPATH=/Users/vojtechvitek/go GO111MODULE= PWD=/Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml go "list" "-e" "-json" "-compiled=true" "-test=true" "-export=false" "-deps=true" "-find=false" "--" "/Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml", stderr: <<>>
2019/08/11 11:05:10 Error:unable to check package for file:///Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/_copy.go: go/packages.Load: no packages found for /Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/_copy.go
2019/08/11 11:05:10 Info:132.130128ms for GOROOT= GOPATH=/Users/vojtechvitek/go GO111MODULE= PWD=/Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml go "list" "-e" "-json" "-compiled=true" "-test=true" "-export=false" "-deps=true" "-find=false" "--" "/Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml", stderr: <<>>
2019/08/11 11:05:10 Error:unable to check package for file:///Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/_copy.go: go/packages.Load: no packages found for /Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/_copy.go
2019/08/11 11:05:10 Info:156.548428ms for GOROOT= GOPATH=/Users/vojtechvitek/go GO111MODULE= PWD=/Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml go "list" "-e" "-json" "-compiled=true" "-test=true" "-export=false" "-deps=true" "-find=false" "--" "/Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml", stderr: <<>>
2019/08/11 11:05:10 Log:packages.Load: found 1 packages
2019/08/11 11:05:10 Log:packages.Load: package github.com/VojtechVitek/yaml with files [/Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/delete.go /Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/match.go /Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/set.go /Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/transform.go /Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/yaml.go]
2019/08/11 11:05:11 Info:138.280368ms for GOROOT= GOPATH=/Users/vojtechvitek/go GO111MODULE= PWD=/Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml go "list" "-e" "-json" "-compiled=true" "-test=true" "-export=false" "-deps=true" "-find=false" "--" "/Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml", stderr: <<>>
2019/08/11 11:05:11 Log:packages.Load: found 1 packages
2019/08/11 11:05:11 Log:packages.Load: package github.com/VojtechVitek/yaml_test with files [/Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/delete_test.go]
2019/08/11 11:05:11 Info:132.936579ms for GOROOT= GOPATH=/Users/vojtechvitek/go GO111MODULE= PWD=/Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml go "list" "-e" "-json" "-compiled=true" "-test=true" "-export=false" "-deps=true" "-find=false" "--" "/Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml", stderr: <<>>
2019/08/11 11:05:11 Log:packages.Load: found 1 packages
2019/08/11 11:05:11 Log:packages.Load: package github.com/VojtechVitek/yaml with files [/Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/delete.go /Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/match.go /Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/set.go /Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/transform.go /Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/yaml.go]
2019/08/11 11:05:11 Error:unable to check package for file:///Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/match.go: no packages found for file:///Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/match.go
2019/08/11 11:05:11 Info:138.990407ms for GOROOT= GOPATH=/Users/vojtechvitek/go GO111MODULE= PWD=/Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml go "list" "-e" "-json" "-compiled=true" "-test=true" "-export=false" "-deps=true" "-find=false" "--" "/Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml", stderr: <<>>
2019/08/11 11:05:11 Log:packages.Load: found 1 packages
2019/08/11 11:05:11 Log:packages.Load: package github.com/VojtechVitek/yaml with files [/Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/delete.go /Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/match.go /Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/set.go /Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/transform.go /Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/yaml.go]
2019/08/11 11:05:11 Info:137.725125ms for GOROOT= GOPATH=/Users/vojtechvitek/go GO111MODULE= PWD=/Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml go "list" "-e" "-json" "-compiled=true" "-test=true" "-export=false" "-deps=true" "-find=false" "--" "/Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml", stderr: <<>>
2019/08/11 11:05:11 Log:packages.Load: found 1 packages
2019/08/11 11:05:11 Log:packages.Load: package github.com/VojtechVitek/yaml with files [/Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/delete.go /Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/match.go /Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/set.go /Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/transform.go /Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/yaml.go]
2019/08/11 11:05:11 Info:135.547401ms for GOROOT= GOPATH=/Users/vojtechvitek/go GO111MODULE= PWD=/Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml go "list" "-e" "-json" "-compiled=true" "-test=true" "-export=false" "-deps=true" "-find=false" "--" "/Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml", stderr: <<>>
2019/08/11 11:05:11 Log:packages.Load: found 1 packages
2019/08/11 11:05:11 Log:packages.Load: package github.com/VojtechVitek/yaml with files [/Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/delete.go /Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/match.go /Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/set.go /Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/transform.go /Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/yaml.go]

check: timed out waiting for results from file:///Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/_copy.go

Interesting. I get timeout error on Go files starting with underscore, ie. _copy.go, files that are ignored by the Go build tools.

Not sure if this was actually causing the above panic I hit last week. But might help?

@stamblerre
Copy link
Contributor

What happens if you explicitly try to run gopls -rpc.trace -v check /Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/_copy.go? It's very possible that gopls is not ignoring files that it should ignore.

@VojtechVitek
Copy link
Author

@stamblerre yep, it times out on files starting with underscore. They should be ignored.

2019/08/12 16:57:36 Error:unable to check package for file:///Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/_copy.go: go/packages.Load: no packages found for /Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/_copy.go
check: timed out waiting for results from file:///Users/vojtechvitek/go/src/github.com/VojtechVitek/yaml/_copy.go

@stamblerre stamblerre changed the title x/tools/gopls: panic in gopls server x/tools/gopls: ignore files starting with undersores Aug 12, 2019
@gopherbot
Copy link

Change https://golang.org/cl/189940 mentions this issue: internal/lsp: ignore files that begin with underscores

@VojtechVitek VojtechVitek changed the title x/tools/gopls: ignore files starting with undersores x/tools/gopls: ignore files starting with underscores Oct 19, 2019
@golang golang locked and limited conversation to collaborators Oct 18, 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. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

3 participants