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/internal/cache: TestZeroConfigAlgorithm/basic_GOPATH_workspace failed in my ubuntu #70196

Closed
xieyuschen opened this issue Nov 5, 2024 · 7 comments
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@xieyuschen
Copy link
Contributor

xieyuschen commented Nov 5, 2024

Go version

gotip

Output of go env in your module/workspace:

GO111MODULE='on'
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/xieyuschen/.cache/go-build'
GOENV='/home/xieyuschen/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/xieyuschen/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/xieyuschen/go'
GOPRIVATE=''
GOPROXY='https://goproxy.cn,direct'
GOROOT='/home/xieyuschen/sdk/gotip'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/xieyuschen/sdk/gotip/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='devel go1.24-8cd550a Fri Sep 6 13:49:31 2024 +0000'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/xieyuschen/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/xieyuschen/codespace/go-tools/gopls/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build4024255374=/tmp/go-build -gno-record-gcc-switches'

What did you do?

$ git clone git@github.com:golang/tools.git --depth 1 && cd tools
$ git rev-parse HEAD
27e1a3a221b2f5da3ea02dc9bb70c6b71c787551
$ uname -a
Linux xieyuschen 6.8.0-48-generic #48~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC 
Mon Oct  7 11:24:13 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
$ cd gopls
$ gotip clean --testcache && gotip test ./internal/cache -run=TestZeroConfigAlgorithm -v

What did you see happen?

=== RUN   TestZeroConfigAlgorithm/basic_GOPATH_workspace
    session_test.go:373: selectViews() mismatch (-want +got):
          []cache.viewSummary{
          	{
        - 		Type: s"GOPATH",
        + 		Type: s"AdHoc",
          		Root: "src",
          		Env:  nil,
          	},
        + 	{Type: s"AdHoc", Root: "src/golang.org/a"},
        + 	{Type: s"AdHoc", Root: "src/golang.org/b"},
          }

What did you expect to see?

The test should pass.

@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Nov 5, 2024
@gopherbot gopherbot added this to the Unreleased milestone Nov 5, 2024
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/625415 mentions this issue: gopls/internal/cache: log go env in TestZeroConfigAlgorithm

@xieyuschen
Copy link
Contributor Author

Hi @rfindley, this is the log after i try bba76372, and thanks for your help:)

$ git rev-parse HEAD
bba763728da3c5798c72b76c57400998049bc33f
$ pwd
/home/xieyuschen/codespace/tools/gopls
$ gotip clean --testcache && gotip test ./internal/cache -run=TestZeroConfigAlgorithm -v

=== RUN   TestZeroConfigAlgorithm/basic_GOPATH_workspace
    session_test.go:348: FetchGoEnv("file:///tmp/TestZeroConfigAlgorithmbasic_GOPATH_workspace1534453248/001/src") = &{GOOS:linux GOARCH:amd64 GOCACHE:/home/xieyuschen/.cache/go-build GOMODCACHE:/tmp/TestZeroConfigAlgorithmbasic_GOPATH_workspace1534453248/001/pkg/mod GOPATH:/tmp/TestZeroConfigAlgorithmbasic_GOPATH_workspace1534453248/001 GOPRIVATE: GOFLAGS: GO111MODULE:on GOTOOLCHAIN:auto GOROOT:/home/xieyuschen/sdk/gotip GoVersion:24 GoVersionOutput:go version devel go1.24-8cd550a Fri Sep 6 13:49:31 2024 +0000 linux/amd64
         ExplicitGOWORK: EffectiveGOPACKAGESDRIVER:}
    session_test.go:375: selectViews() mismatch (-want +got):
          []cache.viewSummary{
          	{
        - 		Type: s"GOPATH",
        + 		Type: s"AdHoc",
          		Root: "src",
          		Env:  nil,
          	},
        + 	{Type: s"AdHoc", Root: "src/golang.org/a"},
        + 	{Type: s"AdHoc", Root: "src/golang.org/b"},
          }

gopherbot pushed a commit to golang/tools that referenced this issue Nov 5, 2024
Add an additional log message to help diagnose the problem encountered
by a user in golang/go#70196.

For golang/go#70196

Change-Id: I8347d842d5a9327fa6797229bf64dc4407f7aa61
Reviewed-on: https://go-review.googlesource.com/c/tools/+/625415
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Hongxiang Jiang <hxjiang@golang.org>
Auto-Submit: Robert Findley <rfindley@google.com>
@findleyr
Copy link
Member

findleyr commented Nov 5, 2024

Thanks @xieyuschen. I added a new log message that can help debug. Can you sync to master and rerun this test, sharing the new log ("FetchGoEnv...")

@findleyr findleyr modified the milestones: Unreleased, gopls/v0.18.0 Nov 5, 2024
@xieyuschen
Copy link
Contributor Author

hi @findleyr , this is the failure log in e5417d7d9f

=== RUN   TestZeroConfigAlgorithm/basic_GOPATH_workspace
    session_test.go:348: FetchGoEnv("file:///tmp/TestZeroConfigAlgorithmbasic_GOPATH_workspace2524377415/001/src") = &{GOOS:linux GOARCH:amd64 GOCACHE:/home/xieyuschen/.cache/go-build GOMODCACHE:/tmp/TestZeroConfigAlgorithmbasic_GOPATH_workspace2524377415/001/pkg/mod GOPATH:/tmp/TestZeroConfigAlgorithmbasic_GOPATH_workspace2524377415/001 GOPRIVATE: GOFLAGS: GO111MODULE:on GOTOOLCHAIN:auto GOROOT:/home/xieyuschen/sdk/gotip GoVersion:24 GoVersionOutput:go version devel go1.24-8cd550a Fri Sep 6 13:49:31 2024 +0000 linux/amd64
         ExplicitGOWORK: EffectiveGOPACKAGESDRIVER:}
    session_test.go:375: selectViews() mismatch (-want +got):
          []cache.viewSummary{
          	{
        - 		Type: s"GOPATH",
        + 		Type: s"AdHoc",
          		Root: "src",
          		Env:  nil,
          	},
        + 	{Type: s"AdHoc", Root: "src/golang.org/a"},
        + 	{Type: s"AdHoc", Root: "src/golang.org/b"},
          }

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/625515 mentions this issue: gopls/internal/cache: ensure GO111MODULE is unset in GOPATH tests

@findleyr
Copy link
Member

findleyr commented Nov 5, 2024

Perfect, thank you. I see that you have GO111MODULE set, which is causing the test to fail as GO111MODULE=on disables GOPATH.

CL incoming to fix the test environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants