2

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

4 Answers 4

10
+50

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
}
Sign up to request clarification or add additional context in comments.

2 Comments

Error loading workspace folders has been resolved but still I am getting error extension prettier Code formatter cannot format
this problem has been answered here. stackoverflow.com/questions/52586965/…
1

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

Comments

0

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.

Comments

0

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

cd ..  
cd System32

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.