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

2

15

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?

Ament answered 10/5, 2019 at 11:14 Comment(0)
A
51

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

Ament answered 10/5, 2019 at 11:14 Comment(1)
even if I downloaded all dependencies, Goland stck at 3 go list -m xxxx processes. when I kill the process it restart again. Why Goland need more information whe the project is build-ready.Architectonics
C
5

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.

Clemmy answered 21/1, 2022 at 12:57 Comment(1)
That doesn't work for my situation. Hopefully it will work for somebody, but I still have NO External Libraries, not even the header, for this one project.Subminiaturize

© 2022 - 2024 — McMap. All rights reserved.