$GOPATH/src.$GOPATH=/home/maelton/go, then your project would be in /home/maelton/go/src/github.com/maelton/myapp.$GOPATH/src too (source code, not binaries).GOPATH.You can now create a go.mod file in any directory, and Go treats that directory as a module root.
Dependencies are not downloaded into your project folder anymore, but instead cached in a global location:
$GOPATH/pkg/mod
Example:
~/go/pkg/mod/github.com/gin-gonic/[email protected]/
Compiled versions of packages (object files) go into:
$GOPATH/pkg/
Your project only has go.mod and go.sum, not the actual dependency code.
go get or go build$GOPATH/pkg/mod.So:
✅ You download the source code, not just the binary.
✅ It goes into a global cache (pkg/mod) instead of your project folder.