Error loading workspace: err: exit status 1: stderr: go: updates to go.sum needed, disabled by -mod=readonly : packages.Load error

Viewed 5716

I am using VSCode and vscode-go to develop the Go application,but, sometime, I got this error, and can't jump to the code definination

How can I get past this error message and get back all gopls features?

1 Answers

As explained in golang/vscode-go issue 1229:

The error message indicates the go.mod file is incomplete and needs update.

Check the "PROBLEMS" view (Ctrl+Shift+P > "Problems: Focus On Problems View" ), find the error-level problem (probably in the go.mod file), and either choose the Quick Fix or check the light bulb.

Or, simply open the go.mod file and run 'go mod tidy' using the code lens at the top of the file.

https://user-images.githubusercontent.com/4999471/110490101-fc008980-80bd-11eb-9b7d-f07e35d46f1a.png

Obviously, make sure you are using the latest versions (of Go, VSCode and vscode-go, as well as gopls)

Related