as per convention
- the main package is found in the
cmd
director at the root level
for all the following commands, by default we run it at the root directory i.e. /Users/ycm/go/src/github.com/purplefox81/learning-go
- run
go build ./...
or rungo build
in a specific dir.go build
wont produce an output file, instead it saves the compiled package in the local build cache - run
go install
in thehello-cmd
directory, or run a full command,go install github.com/purplefox81/learning-go
. It produces an executable calledhello-cmd
in~/go/bin
which is exactly the same as the directory name containing the main package. runhello-cmd
to verify the binary is working
go get xxx
e.g.go get github.com/jinzhu/gorm
for more Go commands, see https://golang.org/cmd/go/
for more Go best practices, see for more Go Test, see
for ...