Many of the tests for golang.org/x/tools/internal/lsp/... fail when run from the module cache, due to the go.mod files in testdata subdirectories cutting off the module (see #27852).
Since the internal/lsp package isn't imported by anything other than gopls, these failures will not occur in go test all in any other module. However, if a user runs go test golang.org/x/tools/... to be sure they have picked up any relevant integration tests for other packages they have imported from x/tools, they may see these failures.
$ go version
go version devel +0951939f Fri Jul 17 19:09:40 2020 +0000 linux/amd64
$ go test golang.org/x/tools/...
ok golang.org/x/tools/benchmark/parse (cached)
ok golang.org/x/tools/blog (cached)
? golang.org/x/tools/blog/atom [no test files]
? golang.org/x/tools/cmd/auth/authtest [no test files]
? golang.org/x/tools/cmd/auth/cookieauth [no test files]
? golang.org/x/tools/cmd/auth/gitauth [no test files]
? golang.org/x/tools/cmd/auth/netrcauth [no test files]
ok golang.org/x/tools/cmd/benchcmp (cached)
ok golang.org/x/tools/cmd/bundle (cached)
ok golang.org/x/tools/cmd/callgraph (cached)
? golang.org/x/tools/cmd/compilebench [no test files]
ok golang.org/x/tools/cmd/cover (cached)
ok golang.org/x/tools/cmd/digraph (cached)
? golang.org/x/tools/cmd/eg [no test files]
ok golang.org/x/tools/cmd/fiximports (cached)
ok golang.org/x/tools/cmd/getgo 0.019s
? golang.org/x/tools/cmd/getgo/server [no test files]
ok golang.org/x/tools/cmd/go-contrib-init (cached)
? golang.org/x/tools/cmd/godex [no test files]
ok golang.org/x/tools/cmd/godoc (cached)
? golang.org/x/tools/cmd/goimports [no test files]
? golang.org/x/tools/cmd/gomvpkg [no test files]
ok golang.org/x/tools/cmd/gorename (cached)
? golang.org/x/tools/cmd/gotype [no test files]
? golang.org/x/tools/cmd/goyacc [no test files]
ok golang.org/x/tools/cmd/guru (cached)
? golang.org/x/tools/cmd/guru/serial [no test files]
? golang.org/x/tools/cmd/html2article [no test files]
? golang.org/x/tools/cmd/present [no test files]
? golang.org/x/tools/cmd/present2md [no test files]
? golang.org/x/tools/cmd/splitdwarf [no test files]
ok golang.org/x/tools/cmd/splitdwarf/internal/macho (cached)
? golang.org/x/tools/cmd/ssadump [no test files]
? golang.org/x/tools/cmd/stress [no test files]
ok golang.org/x/tools/cmd/stringer (cached)
? golang.org/x/tools/cmd/toolstash [no test files]
ok golang.org/x/tools/container/intsets (cached)
ok golang.org/x/tools/cover (cached)
? golang.org/x/tools/go/analysis [no test files]
ok golang.org/x/tools/go/analysis/analysistest (cached)
ok golang.org/x/tools/go/analysis/internal/analysisflags (cached)
ok golang.org/x/tools/go/analysis/internal/checker (cached)
ok golang.org/x/tools/go/analysis/internal/facts (cached)
ok golang.org/x/tools/go/analysis/multichecker (cached)
ok golang.org/x/tools/go/analysis/passes/asmdecl (cached)
ok golang.org/x/tools/go/analysis/passes/assign (cached)
ok golang.org/x/tools/go/analysis/passes/atomic (cached)
ok golang.org/x/tools/go/analysis/passes/atomicalign (cached)
ok golang.org/x/tools/go/analysis/passes/bools (cached)
ok golang.org/x/tools/go/analysis/passes/buildssa (cached)
ok golang.org/x/tools/go/analysis/passes/buildtag (cached)
ok golang.org/x/tools/go/analysis/passes/cgocall (cached)
ok golang.org/x/tools/go/analysis/passes/composite (cached)
ok golang.org/x/tools/go/analysis/passes/copylock (cached)
ok golang.org/x/tools/go/analysis/passes/ctrlflow (cached)
ok golang.org/x/tools/go/analysis/passes/deepequalerrors (cached)
ok golang.org/x/tools/go/analysis/passes/errorsas (cached)
ok golang.org/x/tools/go/analysis/passes/findcall (cached)
? golang.org/x/tools/go/analysis/passes/findcall/cmd/findcall [no test files]
ok golang.org/x/tools/go/analysis/passes/httpresponse (cached)
ok golang.org/x/tools/go/analysis/passes/ifaceassert (cached)
? golang.org/x/tools/go/analysis/passes/ifaceassert/cmd/ifaceassert [no test files]
? golang.org/x/tools/go/analysis/passes/inspect [no test files]
? golang.org/x/tools/go/analysis/passes/internal/analysisutil [no test files]
ok golang.org/x/tools/go/analysis/passes/loopclosure (cached)
ok golang.org/x/tools/go/analysis/passes/lostcancel (cached)
? golang.org/x/tools/go/analysis/passes/lostcancel/cmd/lostcancel [no test files]
ok golang.org/x/tools/go/analysis/passes/nilfunc (cached)
ok golang.org/x/tools/go/analysis/passes/nilness (cached)
? golang.org/x/tools/go/analysis/passes/nilness/cmd/nilness [no test files]
ok golang.org/x/tools/go/analysis/passes/pkgfact (cached)
ok golang.org/x/tools/go/analysis/passes/printf (cached)
ok golang.org/x/tools/go/analysis/passes/shadow (cached)
? golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow [no test files]
ok golang.org/x/tools/go/analysis/passes/shift (cached)
ok golang.org/x/tools/go/analysis/passes/sortslice (cached)
ok golang.org/x/tools/go/analysis/passes/stdmethods (cached)
ok golang.org/x/tools/go/analysis/passes/stringintconv (cached)
? golang.org/x/tools/go/analysis/passes/stringintconv/cmd/stringintconv [no test files]
ok golang.org/x/tools/go/analysis/passes/structtag (cached)
ok golang.org/x/tools/go/analysis/passes/testinggoroutine (cached)
ok golang.org/x/tools/go/analysis/passes/tests (cached)
ok golang.org/x/tools/go/analysis/passes/unmarshal (cached)
? golang.org/x/tools/go/analysis/passes/unmarshal/cmd/unmarshal [no test files]
ok golang.org/x/tools/go/analysis/passes/unreachable (cached)
ok golang.org/x/tools/go/analysis/passes/unsafeptr (cached)
ok golang.org/x/tools/go/analysis/passes/unusedresult (cached)
? golang.org/x/tools/go/analysis/singlechecker [no test files]
ok golang.org/x/tools/go/analysis/unitchecker (cached)
ok golang.org/x/tools/go/ast/astutil (cached)
ok golang.org/x/tools/go/ast/inspector (cached)
ok golang.org/x/tools/go/buildutil (cached)
? golang.org/x/tools/go/callgraph [no test files]
ok golang.org/x/tools/go/callgraph/cha (cached)
ok golang.org/x/tools/go/callgraph/rta (cached)
ok golang.org/x/tools/go/callgraph/static (cached)
ok golang.org/x/tools/go/cfg (cached)
--- FAIL: TestMarker (0.00s)
--- FAIL: TestMarker/testdata/test.go (0.00s)
expect_test.go:57: open testdata/test.go: no such file or directory
--- FAIL: TestMarker/testdata/go.mod (0.00s)
expect_test.go:57: open testdata/go.mod: no such file or directory
FAIL
FAIL golang.org/x/tools/go/expect 0.107s
ok golang.org/x/tools/go/gccgoexportdata (cached)
ok golang.org/x/tools/go/gcexportdata (cached)
? golang.org/x/tools/go/internal/cgo [no test files]
ok golang.org/x/tools/go/internal/gccgoimporter (cached)
ok golang.org/x/tools/go/internal/gcimporter (cached)
? golang.org/x/tools/go/internal/packagesdriver [no test files]
ok golang.org/x/tools/go/loader (cached)
ok golang.org/x/tools/go/packages (cached)
? golang.org/x/tools/go/packages/gopackages [no test files]
ok golang.org/x/tools/go/packages/packagestest (cached)
ok golang.org/x/tools/go/pointer (cached)
ok golang.org/x/tools/go/ssa (cached)
ok golang.org/x/tools/go/ssa/interp (cached)
ok golang.org/x/tools/go/ssa/ssautil (cached)
ok golang.org/x/tools/go/types/objectpath (cached)
ok golang.org/x/tools/go/types/typeutil (cached)
ok golang.org/x/tools/go/vcs (cached)
ok golang.org/x/tools/godoc (cached)
? golang.org/x/tools/godoc/analysis [no test files]
? golang.org/x/tools/godoc/golangorgenv [no test files]
ok golang.org/x/tools/godoc/redirect (cached)
ok golang.org/x/tools/godoc/static (cached)
? golang.org/x/tools/godoc/util [no test files]
ok golang.org/x/tools/godoc/vfs (cached)
ok golang.org/x/tools/godoc/vfs/gatefs (cached)
? golang.org/x/tools/godoc/vfs/httpfs [no test files]
ok golang.org/x/tools/godoc/vfs/mapfs (cached)
ok golang.org/x/tools/godoc/vfs/zipfs (cached)
? golang.org/x/tools/imports [no test files]
? golang.org/x/tools/internal/analysisinternal [no test files]
ok golang.org/x/tools/internal/apidiff (cached)
ok golang.org/x/tools/internal/event (cached) [no tests to run]
? golang.org/x/tools/internal/event/core [no test files]
ok golang.org/x/tools/internal/event/export (cached)
? golang.org/x/tools/internal/event/export/eventtest [no test files]
? golang.org/x/tools/internal/event/export/metric [no test files]
ok golang.org/x/tools/internal/event/export/ocagent (cached)
ok golang.org/x/tools/internal/event/export/ocagent/wire (cached)
? golang.org/x/tools/internal/event/export/prometheus [no test files]
? golang.org/x/tools/internal/event/keys [no test files]
ok golang.org/x/tools/internal/event/label (cached)
? golang.org/x/tools/internal/fakenet [no test files]
ok golang.org/x/tools/internal/fastwalk (cached)
ok golang.org/x/tools/internal/gocommand (cached)
ok golang.org/x/tools/internal/gopathwalk (cached)
ok golang.org/x/tools/internal/imports (cached)
ok golang.org/x/tools/internal/jsonrpc2 (cached)
ok golang.org/x/tools/internal/jsonrpc2/servertest (cached)
--- FAIL: TestLSP (0.66s)
--- FAIL: TestLSP/GOPATH (0.66s)
panic: runtime error: index out of range [0] with length 0 [recovered]
panic: runtime error: index out of range [0] with length 0
goroutine 31 [running]:
testing.tRunner.func1.1(0xba3080, 0xc0005a0140)
/usr/local/google/home/bcmills/sdk/gotip/src/testing/testing.go:1057 +0x30d
testing.tRunner.func1(0xc00008bc80)
/usr/local/google/home/bcmills/sdk/gotip/src/testing/testing.go:1060 +0x41a
panic(0xba3080, 0xc0005a0140)
/usr/local/google/home/bcmills/sdk/gotip/src/runtime/panic.go:969 +0x175
golang.org/x/tools/go/packages/packagestest.Export(0xd04b20, 0xc00008bc80, 0xcf9ae0, 0x10cd090, 0x0, 0x0, 0x0, 0x0)
/tmp/tmp.Wg2Wx8mnBt/_gopath/pkg/mod/golang.org/x/tools@v0.0.0-20200720150256-cf97b7f4a4c1/go/packages/packagestest/export.go:206 +0xfc5
golang.org/x/tools/internal/lsp/tests.Load(0xd04b20, 0xc00008bc80, 0xcf9ae0, 0x10cd090, 0xbfb62d, 0x8, 0xc000172bd0, 0x8, 0xc0000f79e0)
/tmp/tmp.Wg2Wx8mnBt/_gopath/pkg/mod/golang.org/x/tools@v0.0.0-20200720150256-cf97b7f4a4c1/internal/lsp/tests/tests.go:364 +0xbc7
golang.org/x/tools/internal/lsp.testLSP(0xc00008bc80, 0xcf9ae0, 0x10cd090)
/tmp/tmp.Wg2Wx8mnBt/_gopath/pkg/mod/golang.org/x/tools@v0.0.0-20200720150256-cf97b7f4a4c1/internal/lsp/lsp_test.go:47 +0x8e
golang.org/x/tools/go/packages/packagestest.TestAll.func1(0xc00008bc80)
/tmp/tmp.Wg2Wx8mnBt/_gopath/pkg/mod/golang.org/x/tools@v0.0.0-20200720150256-cf97b7f4a4c1/go/packages/packagestest/export.go:156 +0x68
testing.tRunner(0xc00008bc80, 0xc0001f4160)
/usr/local/google/home/bcmills/sdk/gotip/src/testing/testing.go:1108 +0xef
created by testing.(*T).Run
/usr/local/google/home/bcmills/sdk/gotip/src/testing/testing.go:1159 +0x386
FAIL golang.org/x/tools/internal/lsp 0.746s
ok golang.org/x/tools/internal/lsp/analysis/fillreturns (cached)
ok golang.org/x/tools/internal/lsp/analysis/fillstruct (cached)
ok golang.org/x/tools/internal/lsp/analysis/nonewvars (cached)
ok golang.org/x/tools/internal/lsp/analysis/noresultvalues (cached)
ok golang.org/x/tools/internal/lsp/analysis/simplifycompositelit (cached)
ok golang.org/x/tools/internal/lsp/analysis/simplifyrange (cached)
ok golang.org/x/tools/internal/lsp/analysis/simplifyslice (cached)
ok golang.org/x/tools/internal/lsp/analysis/undeclaredname (cached)
ok golang.org/x/tools/internal/lsp/analysis/unusedparams (cached)
? golang.org/x/tools/internal/lsp/browser [no test files]
ok golang.org/x/tools/internal/lsp/cache (cached)
2020/07/20 11:59:32 New session
create_session=1
2020/07/20 11:59:32 Build info
----------
version master, built in $GOPATH mode
Go info
-------
go version devel +0951939f Fri Jul 17 19:09:40 2020 +0000 linux/amd64
2020/07/20 11:59:32 go env for /tmp/fake047865780
(valid build configuration = true)
(build flags: [])
GOMODCACHE=/tmp/tmp.Wg2Wx8mnBt/_gopath/pkg/mod
GONOPROXY=
GOPRIVATE=
GOPROXY=https://proxy.golang.org,direct
GO111MODULE=
GOINSECURE=
GONOSUMDB=
GOPATH=/tmp/tmp.Wg2Wx8mnBt/_gopath
GOFLAGS=
GOMOD=/tmp/fake047865780/go.mod
GOROOT=/usr/local/google/home/bcmills/sdk/gotip
GOCACHE=/usr/local/google/home/bcmills/.cache/go-build
GOSUMDB=sum.golang.org
2020/07/20 11:59:32 go/packages.Load
snapshot=0
directory=/tmp/fake047865780
query=[./... builtin]
packages=2
2020/07/20 11:59:32 warning: diagnose go.mod: no parsed files for package fake, expected: [/tmp/fake047865780/fake.go], errors: [successfully parsed but no token.File for file:///tmp/fake047865780/fake.go (/tmp/fake047865780/fake.go:1:1: expected ';', found 'EOF' (and 2 more errors))], list errors: [fake.go:1:1: expected 'package', found 'EOF']
directory=/tmp/fake047865780
2020/07/20 11:59:32 warning: diagnose package: no parsed files for package fake, expected: [/tmp/fake047865780/fake.go], errors: [successfully parsed but no token.File for file:///tmp/fake047865780/fake.go (/tmp/fake047865780/fake.go:1:1: expected ';', found 'EOF' (and 2 more errors))], list errors: [fake.go:1:1: expected 'package', found 'EOF']
snapshot=0
package="fake"
2020/07/20 11:59:32 go/packages.Load
snapshot=2
directory=/tmp/fake047865780
query=[file=/tmp/fake047865780/fake.go]
packages=1
2020/07/20 11:59:32 go/packages.Load
snapshot=2
package_path="fake"
files=[/tmp/fake047865780/fake.go]
2020/07/20 11:59:32 unable to compute error positions: no file for file:///tmp/tmp.Wg2Wx8mnBt/_gopath/pkg/mod/golang.org/x/tools@v0.0.0-20200720150256-cf97b7f4a4c1/internal/lsp/cmd/fake.go in package fake
package="fake"
2020/07/20 11:59:32 Shutdown session
shutdown_session=1
--- FAIL: TestCommandLine (0.74s)
--- FAIL: TestCommandLine/GOPATH (0.74s)
panic: runtime error: index out of range [0] with length 0 [recovered]
panic: runtime error: index out of range [0] with length 0
goroutine 126 [running]:
testing.tRunner.func1.1(0xbebe20, 0xc0000292c0)
/usr/local/google/home/bcmills/sdk/gotip/src/testing/testing.go:1057 +0x30d
testing.tRunner.func1(0xc00068c300)
/usr/local/google/home/bcmills/sdk/gotip/src/testing/testing.go:1060 +0x41a
panic(0xbebe20, 0xc0000292c0)
/usr/local/google/home/bcmills/sdk/gotip/src/runtime/panic.go:969 +0x175
golang.org/x/tools/go/packages/packagestest.Export(0xd58f40, 0xc00068c300, 0xd4ce20, 0x1144980, 0x0, 0x0, 0x0, 0x0)
/tmp/tmp.Wg2Wx8mnBt/_gopath/pkg/mod/golang.org/x/tools@v0.0.0-20200720150256-cf97b7f4a4c1/go/packages/packagestest/export.go:206 +0xfc5
golang.org/x/tools/internal/lsp/tests.Load(0xd58f40, 0xc00068c300, 0xd4ce20, 0x1144980, 0xc4c3ef, 0xb, 0x10abaeb, 0x2320d9d6b4978166, 0x9b)
/tmp/tmp.Wg2Wx8mnBt/_gopath/pkg/mod/golang.org/x/tools@v0.0.0-20200720150256-cf97b7f4a4c1/internal/lsp/tests/tests.go:364 +0xbc7
golang.org/x/tools/internal/lsp/cmd/test.TestCommandLine.func1(0xc00068c300, 0xd4ce20, 0x1144980)
/tmp/tmp.Wg2Wx8mnBt/_gopath/pkg/mod/golang.org/x/tools@v0.0.0-20200720150256-cf97b7f4a4c1/internal/lsp/cmd/test/cmdtest.go:56 +0x106
golang.org/x/tools/go/packages/packagestest.TestAll.func1(0xc00068c300)
/tmp/tmp.Wg2Wx8mnBt/_gopath/pkg/mod/golang.org/x/tools@v0.0.0-20200720150256-cf97b7f4a4c1/go/packages/packagestest/export.go:156 +0x68
testing.tRunner(0xc00068c300, 0xc0004e7980)
/usr/local/google/home/bcmills/sdk/gotip/src/testing/testing.go:1108 +0xef
created by testing.(*T).Run
/usr/local/google/home/bcmills/sdk/gotip/src/testing/testing.go:1159 +0x386
FAIL golang.org/x/tools/internal/lsp/cmd 1.163s
? golang.org/x/tools/internal/lsp/cmd/test [no test files]
? golang.org/x/tools/internal/lsp/debug [no test files]
? golang.org/x/tools/internal/lsp/debug/tag [no test files]
ok golang.org/x/tools/internal/lsp/diff (cached)
ok golang.org/x/tools/internal/lsp/diff/difftest (cached)
ok golang.org/x/tools/internal/lsp/diff/myers (cached)
ok golang.org/x/tools/internal/lsp/fake (cached)
ok golang.org/x/tools/internal/lsp/fuzzy (cached)
? golang.org/x/tools/internal/lsp/helper [no test files]
ok golang.org/x/tools/internal/lsp/lsprpc (cached)
--- FAIL: TestModfileRemainsUnchanged (0.00s)
mod_test.go:38: stat testdata/unchanged: no such file or directory
FAIL
FAIL golang.org/x/tools/internal/lsp/mod 0.022s
? golang.org/x/tools/internal/lsp/protocol [no test files]
ok golang.org/x/tools/internal/lsp/regtest (cached)
ok golang.org/x/tools/internal/lsp/snippet (cached)
--- FAIL: TestSource (0.72s)
--- FAIL: TestSource/GOPATH (0.72s)
panic: runtime error: index out of range [0] with length 0 [recovered]
panic: runtime error: index out of range [0] with length 0
goroutine 25 [running]:
testing.tRunner.func1.1(0x887880, 0xc000228300)
/usr/local/google/home/bcmills/sdk/gotip/src/testing/testing.go:1057 +0x30d
testing.tRunner.func1(0xc000234c00)
/usr/local/google/home/bcmills/sdk/gotip/src/testing/testing.go:1060 +0x41a
panic(0x887880, 0xc000228300)
/usr/local/google/home/bcmills/sdk/gotip/src/runtime/panic.go:969 +0x175
golang.org/x/tools/go/packages/packagestest.Export(0x969940, 0xc000234c00, 0x962da0, 0xbb6338, 0x0, 0x0, 0x0, 0x0)
/tmp/tmp.Wg2Wx8mnBt/_gopath/pkg/mod/golang.org/x/tools@v0.0.0-20200720150256-cf97b7f4a4c1/go/packages/packagestest/export.go:206 +0xfc5
golang.org/x/tools/internal/lsp/tests.Load(0x969940, 0xc000234c00, 0x962da0, 0xbb6338, 0x8c4ec6, 0xb, 0xc0000f3b48, 0xc0001e24d0, 0xc0001e1f80)
/tmp/tmp.Wg2Wx8mnBt/_gopath/pkg/mod/golang.org/x/tools@v0.0.0-20200720150256-cf97b7f4a4c1/internal/lsp/tests/tests.go:364 +0xbc7
golang.org/x/tools/internal/lsp/source_test.testSource(0xc000234c00, 0x962da0, 0xbb6338)
/tmp/tmp.Wg2Wx8mnBt/_gopath/pkg/mod/golang.org/x/tools@v0.0.0-20200720150256-cf97b7f4a4c1/internal/lsp/source/source_test.go:47 +0x8e
golang.org/x/tools/go/packages/packagestest.TestAll.func1(0xc000234c00)
/tmp/tmp.Wg2Wx8mnBt/_gopath/pkg/mod/golang.org/x/tools@v0.0.0-20200720150256-cf97b7f4a4c1/go/packages/packagestest/export.go:156 +0x68
testing.tRunner(0xc000234c00, 0xc00022ab00)
/usr/local/google/home/bcmills/sdk/gotip/src/testing/testing.go:1108 +0xef
created by testing.(*T).Run
/usr/local/google/home/bcmills/sdk/gotip/src/testing/testing.go:1159 +0x386
FAIL golang.org/x/tools/internal/lsp/source 0.769s
? golang.org/x/tools/internal/lsp/tests [no test files]
ok golang.org/x/tools/internal/memoize (cached)
? golang.org/x/tools/internal/packagesinternal [no test files]
ok golang.org/x/tools/internal/proxydir (cached)
ok golang.org/x/tools/internal/span (cached)
ok golang.org/x/tools/internal/stack (cached)
? golang.org/x/tools/internal/stack/gostacks [no test files]
? golang.org/x/tools/internal/stack/stacktest [no test files]
? golang.org/x/tools/internal/testenv [no test files]
? golang.org/x/tools/internal/tool [no test files]
? golang.org/x/tools/internal/typesinternal [no test files]
? golang.org/x/tools/internal/xcontext [no test files]
? golang.org/x/tools/playground [no test files]
ok golang.org/x/tools/playground/socket (cached)
ok golang.org/x/tools/present (cached)
ok golang.org/x/tools/refactor/eg (cached)
ok golang.org/x/tools/refactor/importgraph (cached)
ok golang.org/x/tools/refactor/rename (cached)
? golang.org/x/tools/refactor/satisfy [no test files]
ok golang.org/x/tools/txtar (cached)
FAIL
-- go.mod --
module example.com
go 1.15
require golang.org/x/tools v0.0.0-20200720150256-cf97b7f4a4c1 // indirect
This package has been moved, and we've deleted the testdata that contains a go.mod file, so I think this is fixed. (I tried to verify, but of course get sumdb errors).
Many of the tests for
golang.org/x/tools/internal/lsp/...
fail when run from the module cache, due to thego.mod
files intestdata
subdirectories cutting off the module (see #27852).Since the
internal/lsp
package isn't imported by anything other thangopls
, these failures will not occur ingo test all
in any other module. However, if a user runsgo test golang.org/x/tools/...
to be sure they have picked up any relevant integration tests for other packages they have imported fromx/tools
, they may see these failures.CC @ianthehat @stamblerre @findleyr