Search code examples
gogolandgo-modules

Goland does not recognise my vendor directory with Go 1.14


When I open my Goland project, the following command is run:

/usr/local/Cellar/go/1.14/libexec/bin/go list -m -json all #gosetup

Its output is the following error:

go list -m: can't compute 'all' using the vendor directory
    (Use -mod=mod or -mod=readonly to bypass.)

Goland cannot resolve the packages I'm importing. When I build and run the project from the command line, it works fine.

My project is structured as follows:

app/
    bin/
    pkg/
    src/
        app/
            cmd/
            vendor/
            go.mod

My GOROOT is /usr/local/Cellar/go/1.14/libexec and my GOPATH is app/.

In Goland settings, under Go/GOPATH have checked the boxes for "Use GOPATH that's defined in system environment" and "Index entire GOPATH".

Under Go/Go Modules (vgo), I have checked "Enable Go Modules (vgo) integration" and "Vendoring mode"

I have just noticed when I change the GOPATH to /Users/myname/sdk/go1.13.4, the problem is solved. Could this be an issue with Homebrew or a change introduced with go 1.14 that I am not aware of?

I'm being exhaustive when describing the issue because I'm unfamiliar with Go and might be missing something obvious. Thanks!


Solution

  • This is a known problem with Go Modules and vendoring support due to tooling change in Go 1.14.

    As such, please try the EAP version of the IDE, https://jetbrains.com/go/nextversion, which contains a fix for this.

    We are tracking this under https://youtrack.jetbrains.com/issue/GO-8855 and thinking about backporting this to the 2019.3 release cycle.