The GOPATH in Go points to the workspace. Can I create multiple projects in my workspace and have GOPATH point to a list of the locations of these projects?
Yes you can have multiple projects in your workspace. However, you do not specify multiple GOPATH
s for that. You simply create your two projects within that GOPATH
environment. And to compile, run etc you simply specify the entry point you want to use.
E.g.
go run src/proj1/proj1.go
go run src/proj2/proj2.go
For more information on GOPATH and workspaces, see the godoc on workspaces.
Specifically, “src contains Go source files organized into packages (one package per directory),”. Notice that you are not limited to only one main package.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With