build.sh does not handle dependencies #6
Description
Installation referenced https://github.com/datacharmer/dbdeployer/ basically gets you to pull down a pre-built set of binaries. That's fine but I like to build my go binaries directly from source. Other projects I use such as orchestrator or vitess basically provide a command line tool which pulls in any required dependencies to enable the build to take place yet this does not happen with dbdeployer
.
This leads to something like:
[myuser@myhost ~/src/dbdeployer/src/github.com/datacharmer/dbdeployer]$ ./build.sh OSX 1.1.1
+ env GOOS=darwin GOARCH=386 go build -o dbdeployer-1.1.1.osx .
main.go:19:2: cannot find package "github.com/datacharmer/dbdeployer/abbreviations" in any of:
/usr/local/Cellar/go/1.10/libexec/src/github.com/datacharmer/dbdeployer/abbreviations (from $GOROOT)
/Users/smudd/src/orchestrator/src/github.com/datacharmer/dbdeployer/abbreviations (from $GOPATH)
main.go:20:2: cannot find package "github.com/datacharmer/dbdeployer/cmd" in any of:
/usr/local/Cellar/go/1.10/libexec/src/github.com/datacharmer/dbdeployer/cmd (from $GOROOT)
/Users/smudd/src/orchestrator/src/github.com/datacharmer/dbdeployer/cmd (from $GOPATH)
tar: dbdeployer-1.1.1.osx: Cannot stat: No such file or directory
tar: Error exit delayed from previous errors.
One of the issues with go is tracking/handling of dependencies. It looks like this may change soon but given the dependencies you are using are quite small putting them under vendor/
and in your tree means there is no external dependency to your packages.
Failing that looking for the missing dependencies and pulling them down can work but then it's not clear if you used the same version of these dependencies that I may be using. Orchestrator has broken because of this and thus keeps its dependencies under vendor/
and these can be tracked in various ways. Vitess has an initial bootstrap.sh
script (as this is more complex and includes other things like zookeeper etc) and pulls down the specific versions that are needed.
I see that:
$ go get github.com/datacharmer/dbdeployer/abbreviations
$ go get github.com/spf13/cobra
is all that is required to allow dbdeployer
to build but do worry that if either of these libraries change unexpectedly you may see breakage.
So commenting on the best way to build from source would be good as it adds a bit more information in addition to the offered binaries.