gopls in VSCode is showing "index out of range" BrokenImport errors for imports

106 Views Asked by At

I've been working on a Go project in VSCode and yesterday gopls in started showing errors like

could not import github.com/Azure/azure-sdk-for-go/sdk/storage/azblob (import failed for "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob": import failed for "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob": internal error while importing "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob" (runtime error: index out of range [581] with length 7); please report an issue) compiler(BrokenImport)

for a number of Azure/azure-sdk-for-go imports. The imports themselves are fine (everything compiles, etc.) so I assume it has to do something with gopls.

I've tried reinstalling gopls, Go itself, VSCode, resetting Go environment variables, VSCode settings. Nothing worked.

I don't believe this is similar to something like Go Modules importing issue in VSCode ("cannot find package [...] in any of [...]") and I couldn't find any references to the "index out of range" BrokenImport errors while googling.

I'm on Linux.

0

There are 0 best solutions below