Anupam Somani
Anupam Somani

Reputation: 224

Update VSCOD Getting Error loading workspace folders

After upgrade every time I open VS Code I get a Error loading workspace folders and Even All the extension were not working

go [-e -json -compiled=true -test=true -export=false -deps=true -find=false -- builtin ibm.com/cloudbroker/order/...]: exit status 1: build flag -mod=readonly only valid when using modules
: packages.Load error[![enter image description here][1]][1]

go version go1.12.17 darwin/amd64 VsCode Version: 1.52.1 OS: Darwin x64 20.2.0

Image Error Messgae

enter image description here

Upvotes: 2

Views: 13872

Answers (4)

Chris
Chris

Reputation: 1

The full error I was getting was that the System32 was showing as system32. On the Terminal, just changed the path.

cd ..  
cd System32

Upvotes: 0

Noteworthy
Noteworthy

Reputation: 409

I am using Windows and I had the same error and for me it was due to a mismatch between the path as it is on the disk vs the path on my powershell session from where I invoked vscode. Windows is not case sensitive when it comes to file paths but when I naviguate to my go project using powershell, I have to respect the case sensitivity for it to work.

Hope, this helps.

Upvotes: 0

Yuvaraj
Yuvaraj

Reputation: 689

I have been struggling with this same issue for a while, thankfully after reading VScode workspace thread and gopals thread, my problem has resolved

My Go Project Structure

Project Structure

In VS code, open working project Repository alone.

Inside the project, run

go mod init module_name

go mod tidy

Hope, this helps

Upvotes: 1

chondroboy
chondroboy

Reputation: 166

January 28 marked a major milestone in both the gopls and VS Code Go journeys, as gopls is now enabled by default in the Go extension for VS Code.

https://blog.golang.org/gopls-vscode-go

you need to disable the go.useLanguageServer flag in your settings.json

mine looks like this:

{
    "go.inferGopath": false,
    "go.toolsGopath": "C:\\Go",
    "go.useLanguageServer": false
}

Upvotes: 10

Related Questions