Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I fix $GOPATH/go.mod exists but should not?

Tags:

linux

go

fedora

I am following this tutorial https://golang.org/doc/tutorial/getting-started but for some reason I keep getting this message every time I try to run the code:

$GOPATH/go.mod exists but should not

I have tried to look at answers like this one: https://stackoverflow.com/a/62062562/9785222 but I dont understand what is GOPATH and where is it.

I am using Vi as an editor on Linux Fedora

like image 387
Nic Avatar asked Jan 17 '26 03:01

Nic


1 Answers

GOPATH defaults to $HOME/go on Unix.

Remove the file $HOME/go/go.mod or explicitly set $GOPATH to a different directory.


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!