"Unable to execute 'go list'' command, run 'go mod tidy' to know more" Error in VSCode

Viewed 2145

Sorry if this is a silly question - just getting started with Go.

I have installed 'go 1.13' (due to this being the version currently supported by Cloud Functions) and the latest version for the VSCode Go extension. This is all in Windows.

I then followed the Go Getting Started Guide. All seems to be working fine - I can run the application and VSCode does not report any syntax errors etc.

Go source in VSCode

Now VSCode just gives me a nagging error message whenever I open a .go or .mod file:

Unable to execute 'go list'' command, run 'go mod tidy' to know more

Go VSCode Error

Running the go mod tidy command does not result in any output. The other tools, such as gopls where installed successfully by VSCode. Any idea what could cause this and how it can be fixed?

2 Answers

This error is caused by the 'Dependency Analysis' extension (redhat.fabric8-analytics). Disabling this extension will result in the error not being shown anymore.

This error is also listed in the FAQ for the Dependency Analysis extension:

FAQ Item 3: Failed to run golist command.

Suggestion: Resolve the error thrown by go mod tidy and go list for the project and try again.

Maybe this will work for someone else but it didn't work for me (only disabling the extension did). In any case, I've raised an issue at the extensions GitHub rep fabric8-analytics/fabric8-analytics-vscode-extension to see if there is another fix but disabling the extension.

I just install the latest version(1.16.3) and work for me.

Related