'Can Jetbrains GoLand use both GoModule and GOPATH?

I'm working in fibrechannel project, and there are same level project(common) that fibrechannel depends on.

When I select Enable Go modules integration as below:

enter image description here

IDE tells me logger not found. (Note I'm using red rectangle to mark the reference and it's actually location under common folder)

enter image description here

After I unclick the Enable Go modules integration checkbox. (Note GOPATH looks like below)

enter image description here

IDE tells me "github.com/pkg/errors" not found.

enter image description here

the go.mod under fibrechannel looks like below:

module fibrechannel/src

go 1.12

require (
    github.com/pkg/errors v0.8.1
    github.com/stretchr/testify v1.3.0
    gopkg.in/iconv.v1 v1.1.1
    gopkg.in/yaml.v2 v2.2.2
)

I'm a newbie in GO language, and I just want the IDE to resolve dependencies successfully.

I'm wondering if there's a way to make both GOPATH and GoModules work in Jetbrains GoLand. If not, is there a way to modify go.mod so that it can include GOPATH?



Solution 1:[1]

Finally, I managed to solve this issue.

B.T.W, since this is an old project maintained by many team members. I don't want to change its code structure, all I need is to read the content without any unknown reference in GoLand.

The solution is NOT to use go modules.

I unchecked the Enable Go modules integration so that only libraries in venders folder not found.

Then I manually added venders folder into GOPATH.

enter image description here

Now dependencies are all resolved!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Bai Bing