Hacker News new | ask | show | jobs
by DelightOne 3195 days ago
Completely separate = dont allow dependencies between or one is base and second auguments and depends on base or dont allow changes to one of them?

How would your ideal system look like? What is your use case?

Sidenote if it helps there is a default gopath location if its not defined: https://golang.org/doc/go1.8#gopath

1 comments

My ideal system is: clone a repo, run `go restore` to fetch dependencies and then `go build` to spit out a binary or `go run` to quickly start the main function.

Nothing from outside the repo can effect that build. Likewise anything inside the repo can’t effect the outside.

Compartmentalizing each project makes builds more reproducible and more obvious. If anyone else clones the same repo and runs the same commands, they should get the same result.

We actually do this at work; our repository is a full GOPATH layout with subdirectories for src/, test/, doc/, etc. We vendor our dependencies. To build, we have scripts at the top-level that compile all of our components (we ship a whole suite of tools in a single repo), run go vet, run tests, etc. The user never needs to set GOPATH. It's not a perfect system, but we've been using it for 3+ years without too much trouble.