Archive for 2022-04-18

Intellij IDEA Golang own package problem

I really like IDEA for developing.

I worked on a golang project and I organised my code into separate packages

The project built without problem in console (go build).

But, in IDEA I got this error:

$GOPATH/go.mod exists but should not

The solution is,

after the module support is turned on (IDEA/preferences/languages/go/Go modules : checkbox), it cannot exist with GOPATH, so just remove the project from GOPATH at IDEA/preferences/languages/go/GOPATH