golang / vscode-go

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

gopls: automated issue report (crash) #3401

Closed Sangwaniya closed 1 month ago

Sangwaniya commented 1 month ago

gopls version: v0.15.3/go1.21.6 gopls flags: update flags: proxy extension version: 0.41.4 environment: Visual Studio Code win32 initialization error: undefined issue timestamp: Thu, 23 May 2024 12:47:58 GMT restart history: Thu, 23 May 2024 12:44:26 GMT: activation (enabled: true)

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

panic: runtime error: slice bounds out of range [45:44]

goroutine 6640 [running]:
golang.org/x/tools/internal/imports.(*ModuleResolver).scanDirForPackage(0xc00076c8f0, {{0xc009370705%3F, 0x7558ca276deb0b9c%3F}, 0x8%3F}, {0xc0003e62a0, 0x2c})
      mod.go:727  0x705
golang.org/x/tools/internal/imports.(*ModuleResolver).scan.func3({{0xc009370705%3F, 0x1a05e20%3F}, 0xc003398180%3F}, {0xc0003e62a0%3F, 0x24112a8%3F})
      mod.go:601  0x50
golang.org/x/tools/internal/gopathwalk.(*walker).walk(0xc009776a20, {0xc003766ec0, 0x37}, 0x0, {0x1e40af8, 0xc00370ed90})
      walk.go:268  0x3d7
golang.org/x/tools/internal/gopathwalk.(*walker).walk(0xc009776a20, {0xc009370705, 0x2c}, 0x0, {0x1e40b30, 0xc003398160})
      walk.go:334  0x87b
golang.org/x/tools/internal/gopathwalk.walkDir({{0xc009370705%3F, 0xc003a53f18%3F}, 0xc003a53f18%3F}, 0xc003398130, 0xc003398120, {0x0%3F, 0x20%3F, 0x4%3F})
      walk.go:120  0x366
golang.org/x/tools/internal/gopathwalk.WalkSkip(...)
      walk.go:77
golang.org/x/tools/internal/imports.(*ModuleResolver).scan.func4()
      mod.go:626  0x2db
created by golang.org/x/tools/internal/imports.(*ModuleResolver).scan in goroutine 4798
      mod.go:610  0x465
gopls stats -anon { "DirStats": { "Files": 2172, "TestdataFiles": 0, "GoFiles": 1626, "ModFiles": 2, "Dirs": 563 }, "GOARCH": "amd64", "GOOS": "windows", "GOPACKAGESDRIVER": "", "GOPLSCACHE": "", "GoVersion": "go1.21.6", "GoplsVersion": "v0.15.3", "InitialWorkspaceLoadDuration": "5.2947379s", "MemStats": { "HeapAlloc": 31101496, "HeapInUse": 39739392, "TotalAlloc": 69362360 }, "WorkspaceStats": { "Files": { "Total": 2207, "Largest": 1654271, "Errs": 0 }, "Views": [ { "GoCommandVersion": "go1.21.6", "AllPackages": { "Packages": 417, "LargestPackage": 134, "CompiledGoFiles": 2217, "Modules": 49 }, "WorkspacePackages": { "Packages": 0, "LargestPackage": 0, "CompiledGoFiles": 0, "Modules": 0 }, "Diagnostics": 0 } ] } }
OPTIONAL: If you would like to share more information, you can attach your complete gopls logs. NOTE: THESE MAY CONTAIN SENSITIVE INFORMATION ABOUT YOUR CODEBASE. DO NOT SHARE LOGS IF YOU ARE WORKING IN A PRIVATE REPOSITORY.
Sangwaniya commented 1 month ago

this issue is the same that https://github.com/golang/go/issues/67156 So closing this one

findleyr commented 1 month ago

@Sangwaniya do you by any chance have a replace directive in your go.mod file? Perhaps one that is an absolute windows file path?

Sangwaniya commented 1 month ago

@findleyr yes i forgot about that in windows path separator value is "\" (double backslash) butt i changed to '/' to avoid error while extracting data from aws using cli. image after that i haven't changed back, btw windows always giving error due to this path separator value, needs to update it on many tasks 😵‍💫

findleyr commented 1 month ago

@Sangwaniya are you saying that the crash was avoided once you changed the path separator back, and rebuilt gopls?

I would expect that very few applications work correctly on windows when build with a modified GOROOT that changes the path separator.

Sangwaniya commented 1 month ago

@findleyr I corrected the path separator value but still gopls crashing. here is crashing report after the correcting the path separator value: gopls version: v0.15.3/go1.21.6 gopls flags: update flags: proxy extension version: 0.41.4 environment: Visual Studio Code win32 initialization error: undefined issue timestamp: Wed, 29 May 2024 14:11:39 GMT restart history: Wed, 29 May 2024 14:08:10 GMT: activation (enabled: true)

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

panic: runtime error: slice bounds out of range [45:44]

goroutine 6535 [running]:
golang.org/x/tools/internal/imports.(*ModuleResolver).scanDirForPackage(0xc000e6e840, {{0xc00536f6a5%3F, 0x3071f2db721b2800%3F}, 0x8%3F}, {0xc0077bcb40, 0x2c})
      mod.go:727  0x705
golang.org/x/tools/internal/imports.(*ModuleResolver).scan.func3({{0xc00536f6a5%3F, 0xeb5e20%3F}, 0xc006a09760%3F}, {0xc0077bcb40%3F, 0x18c12a8%3F})
      mod.go:601  0x50
golang.org/x/tools/internal/gopathwalk.(*walker).walk(0xc0067a3c20, {0xc0089d5640, 0x37}, 0x0, {0x12f0af8, 0xc006dff650})
      walk.go:268  0x3d7
golang.org/x/tools/internal/gopathwalk.(*walker).walk(0xc0067a3c20, {0xc00536f6a5, 0x2c}, 0x0, {0x12f0b30, 0xc006a09740})
      walk.go:334  0x87b
golang.org/x/tools/internal/gopathwalk.walkDir({{0xc00536f6a5%3F, 0xc003037f18%3F}, 0xc003037f18%3F}, 0xc006a09710, 0xc006a09700, {0x0%3F, 0x0%3F, 0x4%3F})
      walk.go:120  0x366
golang.org/x/tools/internal/gopathwalk.WalkSkip(...)
      walk.go:77
golang.org/x/tools/internal/imports.(*ModuleResolver).scan.func4()
      mod.go:626  0x2db
created by golang.org/x/tools/internal/imports.(*ModuleResolver).scan in goroutine 4807
      mod.go:610  0x465
gopls stats -anon { "DirStats": { "Files": 2172, "TestdataFiles": 0, "GoFiles": 1626, "ModFiles": 2, "Dirs": 555 }, "GOARCH": "amd64", "GOOS": "windows", "GOPACKAGESDRIVER": "", "GOPLSCACHE": "", "GoVersion": "go1.21.6", "GoplsVersion": "v0.15.3", "InitialWorkspaceLoadDuration": "3.818475s", "MemStats": { "HeapAlloc": 31110824, "HeapInUse": 40493056, "TotalAlloc": 86128408 }, "WorkspaceStats": { "Files": { "Total": 2205, "Largest": 1654271, "Errs": 0 }, "Views": [ { "GoCommandVersion": "go1.21.6", "AllPackages": { "Packages": 417, "LargestPackage": 134, "CompiledGoFiles": 2217, "Modules": 49 }, "WorkspacePackages": { "Packages": 0, "LargestPackage": 0, "CompiledGoFiles": 0, "Modules": 0 }, "Diagnostics": 0 } ] } }
OPTIONAL: If you would like to share more information, you can attach your complete gopls logs. NOTE: THESE MAY CONTAIN SENSITIVE INFORMATION ABOUT YOUR CODEBASE. DO NOT SHARE LOGS IF YOU ARE WORKING IN A PRIVATE REPOSITORY.
findleyr commented 1 month ago

@Sangwaniya did you rebuild gopls after making this fix?

findleyr commented 1 month ago

Let's continue discussion on golang/go#67156.