Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Golang - how to define multiple projects in workspace

Tags:

go

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?

like image 863
tldr Avatar asked Sep 07 '13 14:09

tldr


1 Answers

Yes you can have multiple projects in your workspace. However, you do not specify multiple GOPATHs 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.

like image 67
Kissaki Avatar answered Sep 28 '22 07:09

Kissaki