vscode: Error loading workspace: err: exit status 1: stderr: build flag -mod=readonly only valid

When writing Golang code in VS Code for Windows, the following error occurs:

Error loading workspace: err: exit status 1: stderr: build flag -mod=readonly only valid when using modules : packages.Load error


Solutions:
Enter the following on the command line:

go env -w GO111MODULE=on

Read More: