2018-09-18 16:42:38 -04:00
|
|
|
.PHONY: build install test doc fmt lint vet
|
|
|
|
|
|
|
|
export GOPATH
|
|
|
|
|
|
|
|
VERSION ?= $(shell git describe --tags --always --dirty)
|
|
|
|
DIR_BIN = ./bin
|
|
|
|
DIR_PKG = ./pkg
|
2018-10-04 22:13:52 -04:00
|
|
|
DIR_CLI = ./cli
|
2018-09-18 16:42:38 -04:00
|
|
|
|
|
|
|
default: build
|
|
|
|
|
|
|
|
build: install vet generate test compile
|
|
|
|
|
2018-09-25 21:49:42 -04:00
|
|
|
compile:
|
2018-09-18 16:42:38 -04:00
|
|
|
go build -v -o ${DIR_BIN}/ferret \
|
2018-10-13 22:00:29 -04:00
|
|
|
-ldflags "-X main.version=${VERSION}" \
|
2018-10-04 22:13:52 -04:00
|
|
|
./main.go
|
2018-09-18 16:42:38 -04:00
|
|
|
|
|
|
|
install:
|
|
|
|
dep ensure
|
|
|
|
|
|
|
|
test:
|
|
|
|
go test ${DIR_PKG}/...
|
|
|
|
|
|
|
|
generate:
|
2018-09-27 17:03:49 -04:00
|
|
|
go generate ${DIR_PKG}/...
|
2018-09-18 16:42:38 -04:00
|
|
|
|
|
|
|
doc:
|
|
|
|
godoc -http=:6060 -index
|
|
|
|
|
|
|
|
# http://golang.org/cmd/go/#hdr-Run_gofmt_on_package_sources
|
|
|
|
fmt:
|
2018-10-04 22:13:52 -04:00
|
|
|
go fmt ${DIR_CLI}/... ${DIR_PKG}/...
|
2018-09-18 16:42:38 -04:00
|
|
|
|
2018-10-05 18:59:42 -04:00
|
|
|
# https://github.com/mgechev/revive
|
|
|
|
# go get github.com/mgechev/revive
|
2018-09-18 16:42:38 -04:00
|
|
|
lint:
|
2018-10-05 20:56:15 -04:00
|
|
|
revive -config revive.toml -formatter friendly -exclude ./pkg/parser/fql/... -exclude ./vendor/... ./...
|
2018-09-18 16:42:38 -04:00
|
|
|
|
|
|
|
# http://godoc.org/code.google.com/p/go.tools/cmd/vet
|
|
|
|
# go get code.google.com/p/go.tools/cmd/vet
|
|
|
|
vet:
|
2018-10-05 18:59:42 -04:00
|
|
|
go vet ${DIR_CLI}/... ${DIR_PKG}/...
|
2018-10-13 21:30:50 -04:00
|
|
|
|
|
|
|
release:
|
|
|
|
goreleaser
|