$GOPATH/go.mod exists but should not

Answered

Hi, I'm beginner in go language and when I try go run project in %HOMEPATH% in terminal, project run perfectly. bun when I try to create a new project in Goland 23.1 and run project, show this error:

$GOPATH/go.mod exists but should not

what can I do?

thank for your help.

0
1 comment

Hi, 

It looks like a configuration issue where the GOPATH Is set to the project directory perhaps?

I recommend using the GOPATH under $HOME/go and create your project outside of it. Also, please remove the $GOPATH/src/go.mod if it exists (as this is a requirement from Go, as seen in the error from the compiler).

0

Please sign in to leave a comment.