golang / vscode-go

Go extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=golang.Go
Other
3.79k stars 729 forks source link

gopls: automated issue report (crash) #3164

Closed Arlet2 closed 5 months ago

Arlet2 commented 5 months ago

gopls version: v0.13.2/go1.22.0 gopls flags: update flags: proxy extension version: 0.40.3 environment: Visual Studio Code linux initialization error: undefined issue timestamp: Wed, 07 Feb 2024 20:36:27 GMT restart history: Wed, 07 Feb 2024 20:36:18 GMT: activation (enabled: true)

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

I just updated Go version from 1.21.6 to 1.22.0 and restarted VS code. Logs from test repo but I have got this problem in all repos.

Please attach the stack trace from the crash. A window with the error message should have popped up in the lower half of your screen. Please copy the stack trace and error messages from that window and paste it in this issue.

[Info - 11:36:18 PM] 2024/02/07 23:36:18 go info for /home/arlet/projects/test (go dir /home/arlet/projects/test) (go version go version go1.22.0 linux/amd64) (valid build configuration = true) (build flags: []) (selected go env: [GO111MODULE=, GOCACHE=/home/arlet/.cache/go-build, GOFLAGS=-modcacherw, GOMODCACHE=/home/arlet/.local/bin/pkg/mod, GOPATH=/home/arlet/.local/bin, GOPRIVATE=values, GOROOT=/home/arlet/go, GOWORK=])

[Info - 11:36:19 PM] 2024/02/07 23:36:19 go/packages.Load #1: updating metadata for 0 packages

[Info - 11:36:19 PM] 2024/02/07 23:36:19 go/packages.Load #1 snapshot=0 directory=file:///home/arlet/projects/test query=[/home/arlet/projects/test/... builtin] packages=1

[Error - 11:36:19 PM] Request textDocument/semanticTokens/range failed. Message: semantictokens are disabled Code: 0 [Error - 11:36:19 PM] Request textDocument/semanticTokens/full failed. Message: semantictokens are disabled Code: 0 [Error - 11:36:19 PM] Request textDocument/semanticTokens/range failed. Message: semantictokens are disabled Code: 0 [Error - 11:36:24 PM] Request textDocument/semanticTokens/full failed. Message: semantictokens are disabled Code: 0 [Info - 11:36:24 PM] 2024/02/07 23:36:24 go/packages.Load #3: updating metadata for 1 packages

[Info - 11:36:24 PM] 2024/02/07 23:36:24 go/packages.Load #3 snapshot=2 directory=file:///home/arlet/projects/test query=[file=/home/arlet/projects/test/main.go] packages=1

panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xc2201a]

goroutine 198 [running]: golang.org/x/tools/gopls/internal/lsp/cache.localPackageKey({{0xc000805e18, 0x4}, {0xc000805e18, 0x4}, {0x0, 0x0}, {0xc000217030, 0x1, 0x1}, {0xc000217050, ...}, ...}) /home/arlet/.local/bin/pkg/mod/golang.org/x/tools/gopls@v0.13.2/internal/lsp/cache/check.go:1402 +0x93a golang.org/x/tools/gopls/internal/lsp/cache.(packageHandleBuilder).buildPackageHandle(0xc0007284e0, {0x11a6060, 0xc000117900}, 0xc0001178b0) /home/arlet/.local/bin/pkg/mod/golang.org/x/tools/gopls@v0.13.2/internal/lsp/cache/check.go:1090 +0x2be golang.org/x/tools/gopls/internal/lsp/cache.(snapshot).getPackageHandles.func2.1() /home/arlet/.local/bin/pkg/mod/golang.org/x/tools/gopls@v0.13.2/internal/lsp/cache/check.go:891 +0xce golang.org/x/sync/errgroup.(Group).Go.func1() /home/arlet/.local/bin/pkg/mod/golang.org/x/sync@v0.3.0/errgroup/errgroup.go:75 +0x56 created by golang.org/x/sync/errgroup.(Group).Go in goroutine 228 /home/arlet/.local/bin/pkg/mod/golang.org/x/sync@v0.3.0/errgroup/errgroup.go:72 +0x96 [Info - 11:36:24 PM] true [Info - 11:36:25 PM] 2024/02/07 23:36:25 go info for /home/arlet/projects/test (go dir /home/arlet/projects/test) (go version go version go1.22.0 linux/amd64) (valid build configuration = true) (build flags: []) (selected go env: [GO111MODULE=, GOCACHE=/home/arlet/.cache/go-build, GOFLAGS=-modcacherw, GOMODCACHE=/home/arlet/.local/bin/pkg/mod, GOPATH=/home/arlet/.local/bin, GOPRIVATE=values, GOROOT=/home/arlet/go, GOWORK=])

[Info - 11:36:25 PM] 2024/02/07 23:36:25 go/packages.Load #1: updating metadata for 1 packages

[Info - 11:36:25 PM] 2024/02/07 23:36:25 go/packages.Load #1 snapshot=0 directory=file:///home/arlet/projects/test query=[/home/arlet/projects/test/... builtin] packages=2

panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xc2201a]

goroutine 165 [running]: golang.org/x/tools/gopls/internal/lsp/cache.localPackageKey({{0xc0001def4c, 0x4}, {0xc0001def4c, 0x4}, {0x0, 0x0}, {0xc0001d6ea0, 0x1, 0x1}, {0xc0001d6ed0, ...}, ...}) /home/arlet/.local/bin/pkg/mod/golang.org/x/tools/gopls@v0.13.2/internal/lsp/cache/check.go:1402 +0x93a golang.org/x/tools/gopls/internal/lsp/cache.(packageHandleBuilder).buildPackageHandle(0xc000740f60, {0x11a6060, 0xc00013f7c0}, 0xc00013f770) /home/arlet/.local/bin/pkg/mod/golang.org/x/tools/gopls@v0.13.2/internal/lsp/cache/check.go:1090 +0x2be golang.org/x/tools/gopls/internal/lsp/cache.(snapshot).getPackageHandles.func2.1() /home/arlet/.local/bin/pkg/mod/golang.org/x/tools/gopls@v0.13.2/internal/lsp/cache/check.go:891 +0xce golang.org/x/sync/errgroup.(Group).Go.func1() /home/arlet/.local/bin/pkg/mod/golang.org/x/sync@v0.3.0/errgroup/errgroup.go:75 +0x56 created by golang.org/x/sync/errgroup.(Group).Go in goroutine 179 /home/arlet/.local/bin/pkg/mod/golang.org/x/sync@v0.3.0/errgroup/errgroup.go:72 +0x96 [Info - 11:36:25 PM] true [Info - 11:36:25 PM] 2024/02/07 23:36:25 go info for /home/arlet/projects/test (go dir /home/arlet/projects/test) (go version go version go1.22.0 linux/amd64) (valid build configuration = true) (build flags: []) (selected go env: [GO111MODULE=, GOCACHE=/home/arlet/.cache/go-build, GOFLAGS=-modcacherw, GOMODCACHE=/home/arlet/.local/bin/pkg/mod, GOPATH=/home/arlet/.local/bin, GOPRIVATE=values, GOROOT=/home/arlet/go, GOWORK=])

[Info - 11:36:26 PM] 2024/02/07 23:36:26 go/packages.Load #1 snapshot=0 directory=file:///home/arlet/projects/test query=[/home/arlet/projects/test/... builtin] packages=2

[Info - 11:36:26 PM] 2024/02/07 23:36:26 go/packages.Load #1: updating metadata for 1 packages

panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xc2201a]

goroutine 145 [running]: golang.org/x/tools/gopls/internal/lsp/cache.localPackageKey({{0xc0006d443c, 0x4}, {0xc0006d443c, 0x4}, {0x0, 0x0}, {0xc00019fbe0, 0x1, 0x1}, {0xc00019fc20, ...}, ...}) /home/arlet/.local/bin/pkg/mod/golang.org/x/tools/gopls@v0.13.2/internal/lsp/cache/check.go:1402 +0x93a golang.org/x/tools/gopls/internal/lsp/cache.(packageHandleBuilder).buildPackageHandle(0xc0006719b0, {0x11a6060, 0xc0005bb1d0}, 0xc0005bb180) /home/arlet/.local/bin/pkg/mod/golang.org/x/tools/gopls@v0.13.2/internal/lsp/cache/check.go:1090 +0x2be golang.org/x/tools/gopls/internal/lsp/cache.(snapshot).getPackageHandles.func2.1() /home/arlet/.local/bin/pkg/mod/golang.org/x/tools/gopls@v0.13.2/internal/lsp/cache/check.go:891 +0xce golang.org/x/sync/errgroup.(Group).Go.func1() /home/arlet/.local/bin/pkg/mod/golang.org/x/sync@v0.3.0/errgroup/errgroup.go:75 +0x56 created by golang.org/x/sync/errgroup.(Group).Go in goroutine 122 /home/arlet/.local/bin/pkg/mod/golang.org/x/sync@v0.3.0/errgroup/errgroup.go:72 +0x96 [Info - 11:36:26 PM] true [Info - 11:36:26 PM] 2024/02/07 23:36:26 go info for /home/arlet/projects/test (go dir /home/arlet/projects/test) (go version go version go1.22.0 linux/amd64) (valid build configuration = true) (build flags: []) (selected go env: [GO111MODULE=, GOCACHE=/home/arlet/.cache/go-build, GOFLAGS=-modcacherw, GOMODCACHE=/home/arlet/.local/bin/pkg/mod, GOPATH=/home/arlet/.local/bin, GOPRIVATE=values, GOROOT=/home/arlet/go, GOWORK=])

[Info - 11:36:26 PM] 2024/02/07 23:36:26 go/packages.Load #1 snapshot=0 directory=file:///home/arlet/projects/test query=[/home/arlet/projects/test/... builtin] packages=2

[Info - 11:36:26 PM] 2024/02/07 23:36:26 go/packages.Load #1: updating metadata for 1 packages

panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xc2201a]

goroutine 151 [running]: golang.org/x/tools/gopls/internal/lsp/cache.localPackageKey({{0xc000612fdc, 0x4}, {0xc000612fdc, 0x4}, {0x0, 0x0}, {0xc00049ff50, 0x1, 0x1}, {0xc00049ff70, ...}, ...}) /home/arlet/.local/bin/pkg/mod/golang.org/x/tools/gopls@v0.13.2/internal/lsp/cache/check.go:1402 +0x93a golang.org/x/tools/gopls/internal/lsp/cache.(packageHandleBuilder).buildPackageHandle(0xc000689110, {0x11a6060, 0xc000366730}, 0xc0003666e0) /home/arlet/.local/bin/pkg/mod/golang.org/x/tools/gopls@v0.13.2/internal/lsp/cache/check.go:1090 +0x2be golang.org/x/tools/gopls/internal/lsp/cache.(snapshot).getPackageHandles.func2.1() /home/arlet/.local/bin/pkg/mod/golang.org/x/tools/gopls@v0.13.2/internal/lsp/cache/check.go:891 +0xce golang.org/x/sync/errgroup.(Group).Go.func1() /home/arlet/.local/bin/pkg/mod/golang.org/x/sync@v0.3.0/errgroup/errgroup.go:75 +0x56 created by golang.org/x/sync/errgroup.(Group).Go in goroutine 143 /home/arlet/.local/bin/pkg/mod/golang.org/x/sync@v0.3.0/errgroup/errgroup.go:72 +0x96 [Info - 11:36:26 PM] true [Info - 11:36:27 PM] 2024/02/07 23:36:27 go info for /home/arlet/projects/test (go dir /home/arlet/projects/test) (go version go version go1.22.0 linux/amd64) (valid build configuration = true) (build flags: []) (selected go env: [GO111MODULE=, GOCACHE=/home/arlet/.cache/go-build, GOFLAGS=-modcacherw, GOMODCACHE=/home/arlet/.local/bin/pkg/mod, GOPATH=/home/arlet/.local/bin, GOPRIVATE=values, GOROOT=/home/arlet/go, GOWORK=])

[Info - 11:36:27 PM] 2024/02/07 23:36:27 go/packages.Load #1 snapshot=0 directory=file:///home/arlet/projects/test query=[/home/arlet/projects/test/... builtin] packages=2

[Info - 11:36:27 PM] 2024/02/07 23:36:27 go/packages.Load #1: updating metadata for 1 packages

panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xc2201a]

goroutine 153 [running]: golang.org/x/tools/gopls/internal/lsp/cache.localPackageKey({{0xc000442fec, 0x4}, {0xc000442fec, 0x4}, {0x0, 0x0}, {0xc00035cb70, 0x1, 0x1}, {0xc00035cbb0, ...}, ...}) /home/arlet/.local/bin/pkg/mod/golang.org/x/tools/gopls@v0.13.2/internal/lsp/cache/check.go:1402 +0x93a golang.org/x/tools/gopls/internal/lsp/cache.(packageHandleBuilder).buildPackageHandle(0xc0005dac60, {0x11a6060, 0xc0000be780}, 0xc0000be730) /home/arlet/.local/bin/pkg/mod/golang.org/x/tools/gopls@v0.13.2/internal/lsp/cache/check.go:1090 +0x2be golang.org/x/tools/gopls/internal/lsp/cache.(snapshot).getPackageHandles.func2.1() /home/arlet/.local/bin/pkg/mod/golang.org/x/tools/gopls@v0.13.2/internal/lsp/cache/check.go:891 +0xce golang.org/x/sync/errgroup.(Group).Go.func1() /home/arlet/.local/bin/pkg/mod/golang.org/x/sync@v0.3.0/errgroup/errgroup.go:75 +0x56 created by golang.org/x/sync/errgroup.(Group).Go in goroutine 165 /home/arlet/.local/bin/pkg/mod/golang.org/x/sync@v0.3.0/errgroup/errgroup.go:72 +0x96 [Error - 11:36:27 PM]

Failed to auto-collect gopls trace: incomplete panic trace.

gopls stats -anon Initializing workspace... panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xc2201a] goroutine 124 [running]: golang.org/x/tools/gopls/internal/lsp/cache.localPackageKey({{0xc0000145a8, 0x4}, {0xc0000145a8, 0x4}, {0xc0000145ac, 0x4}, {0xc0001de310, 0x1, 0x1}, {0xc0001de490, ...}, ...}) /home/arlet/.local/bin/pkg/mod/golang.org/x/tools/gopls@v0.13.2/internal/lsp/cache/check.go:1402 +0x93a golang.org/x/tools/gopls/internal/lsp/cache.(*packageHandleBuilder).buildPackageHandle(0xc000438a50, {0x11a6060, 0xc0004485a0}, 0xc000448550) /home/arlet/.local/bin/pkg/mod/golang.org/x/tools/gopls@v0.13.2/internal/lsp/cache/check.go:1090 +0x2be golang.org/x/tools/gopls/internal/lsp/cache.(*snapshot).getPackageHandles.func2.1() /home/arlet/.local/bin/pkg/mod/golang.org/x/tools/gopls@v0.13.2/internal/lsp/cache/check.go:891 +0xce golang.org/x/sync/errgroup.(*Group).Go.func1() /home/arlet/.local/bin/pkg/mod/golang.org/x/sync@v0.3.0/errgroup/errgroup.go:75 +0x56 created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 170 /home/arlet/.local/bin/pkg/mod/golang.org/x/sync@v0.3.0/errgroup/errgroup.go:72 +0x96
hyangah commented 5 months ago

@Arlet2 Can you please update the gopls and see if this is reproducible? The latest version is v0.14.2, and we are pretty close to v0.15.0 release.

Arlet2 commented 5 months ago

Thank you, I didn't notice that my proxy server has got old version of gopls. On v0.14.2 gopls works correct