I just had the same problem in GoLand (which is Intellij IDEA for Go) and worked out a solution. You need to change the Run kind
from File
to Package
or Directory
. You can choose this from a drop-down if you go into Run/Edit
Configurations.
Eg: for package ~/go/src/a_package
, use a Package path
of a_package
and a Directory
of ~/go/src/a_package
and Run kind
of Package
or Directory
.