go
tool can create a binary and place it to GOBIN
if package contains a main
sub package (or if package is a main
). Is there a possibility to create a few (at least two) binaries with single go install package
command? Meaning without using GNU make
for this purposes.
Thank you.
AFAIK this is not possible. The usual convential is that you put your binaries into packages that have cmd
as their last path element. People can then install all the binaries like this:
go get code.google.com/p/codesearch/cmd/{cindex,csearch,cgrep}
It is definitely possible if all commands are under a common directory, using go install root/...
. The trailing three dots tell the go command to do this for all packages under this directory. The same three-dots notation works for go get
or go build
and probably all go commands.
An import path is a pattern if it includes one or more "..." wildcards, each of which can match any string, including the empty string and strings containing slashes. Such a pattern expands to all package directories found in the GOPATH trees with names matching the patterns. As a special case, x/... matches x as well as x's subdirectories. For example, net/... expands to net and packages in its subdirectories.