Skip to content

Latest commit

 

History

History
44 lines (27 loc) · 1.71 KB

Skycoin-project-Makefile-standards.md

File metadata and controls

44 lines (27 loc) · 1.71 KB

All Skycoin projects based upon Go should have a Makefile that includes certain commands described below.

For reference, see the Skycoin Makefile and the Teller Makefile.

make help

Add this to the Makefile:

.DEFAULT_GOAL := help

help:
	@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

This will print a help text when invoking make or make help. Commands are documented by adding a comment after ## on the same line as the command name, for example:

format: ## Formats the code
	goimports -w -local github.com/skycoin/skycoin ./cmd

Invoking make will print the following:

$ make
format                         Formats the code

make format

A make format command should use goimports to format the source code.

make test

A make test command should run the tests with go test

make lint

A make lint command should run code linters. If the code uses vendored depedencies it should call vendorcheck. golangci-lint should be used for code linting. Not every linter provided by golangci-lint is required to be used. See Skycoin's golangci-lint configuration file for an example linter configuration. At the very least, the golint, goimports and govet linters should be used.

make check

make check should invoke make lint followed by make test. make check should succeed before merging code.