Il giorno domenica 5 febbraio 2017 06:35:18 UTC+1, jeffk...@gmail.com ha scritto: > > I can’t seem to converge on a decent package/version management scheme. I > asked Dave Cheney, and he recommended that I email this list. > > > > I’ve written a Go project. I started with a directory tree like this: > > > $GOPATH/src/project/objects/agent_v1/agent_v1.go (import > “project/objects/agent_v1”) > $GOPATH/src/project/objects/customer_v1/customer_v1.go (import > “project/objects/customer_v1”) Etc. > > > > I know that I needed to be able to support different versions of my > objects, so that is the directory structure I started using. > > >
Is your project a package (for other developers to use) or an application? > What I’m looking for: A solution that will: > > a) make builds reproducible. > If your project is a package, usually (IMHO) you should forget about making builds reproducible. This is responsibility of the develper that uses your package in his project. b) use SemVer 2.0.0 versioning. > You can just add tags or branches on your git repository following, as an example, the convention proposed by Dave Cheney. > [...] > e) use the standard Go tooling as much as possible. Only use > other tooling where the standard Go tooling won’t work for package/version > management. > For web applications I use the layout proposed by Dave Cheney in db (but this layout seems to be used by other projects, too). I use gb build when building, since it is convenient, but I use standard go tools for everything else, using this script named go+" #!/bin/sh # Execute the go tool for the current project. # The project should have the layout as defined by the gb tool. GOPATH="$PWD:$PWD/vendor" GOBIN="$PWD/bin" go $@ When importing dependencies I use gb vendor fetch, but for some cases I just clone the repository inside vendor/src/. If your project is a package you can import the dependency in a vendor directory. There are some example in the Go standard library. However you should be careful, since some packages can not be imported multiple time (like the SQL drivers). Manlio -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.