sdgluck
sdgluck

Reputation: 27237

Fix GoLand not finding module dependencies ("cannot resolve...")?

I have installed my project's Go module dependencies with go build.

But GoLand is telling me it cannot resolve any of these dependencies.

How can I get GoLand to find the Go module dependencies?

Upvotes: 18

Views: 13650

Answers (2)

Hoiama Rodrigues
Hoiama Rodrigues

Reputation: 346

navigate to path project with your file "go.mod" and execute the command line

go clean --modcache && go mod download

this will download every thing again.

if was necessary, remote all require block from your go.mod with tag "// indirect" and execute command

go mod tidy

that will downlaod all sub-dependences again.

OBS: if you project path is in $PATH system, you need remove, because now the go.mod is the sufficient to replace it.

Upvotes: 5

sdgluck
sdgluck

Reputation: 27237

Make sure that you have Go Modules support enabled.

In your preferences go to Go > Go Modules (vgo) and check "Enable Go Modules":

enter image description here

Upvotes: 60

Related Questions