An opinionated Makefile for Go projects.
An opinionated Makefile for Go projects.
go.mk
to your project:curl -O https://raw.githubusercontent.com/hgfischer/gomk/master/go.mk
include go.mk
in a new or existing Makefile;Makefile.sample
to see some examples on how to integrate with
your own build workflow:curl -O https://raw.githubusercontent.com/hgfischer/gomk/master/Makefile.sample
GoMk defines default variables and targets for a Go project, to help maintain a healthy project. It also checks your current Go environment.
APPBIN
: name of the application, based on the repository nameGOSOURCES
: all .go
files inside the project repositoryGOPKGS
: all Go pkgs inside the project repositoryNOTE: Check the go.mk file for other predefined variables that may conflict with other variables defined in your Makefile.
gomkbuild
: build the application binary, if there is onegomkxbuild
: build all cross-platform binaries, using gox
gomkclean
: clean the project directory of the files produced by go.mkgomkupdate
: update your go.mk filevet
: run go tool vet
in each source filelint
: run golint
in each source filefmt
: run go fmt
in the entire projecttest
: run go test
for all pkgs in the projectrace
: run go test
with race detection in all pkgs in the projectdeps
: install all deps needed by the projectcover
: run tests with coverage report in all pkgs in the projectsprintvars
: print all variables defined in the Makefilesavegodeps
: save all deps with godeprestoregodeps
: restore all deps with godepupdategodeps
: update all deps with godepgb