2018-09-18 22:42:38 +02: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-05 04:13:52 +02:00
|
|
|
DIR_CLI = ./cli
|
2018-09-18 22:42:38 +02:00
|
|
|
|
|
|
|
default: build
|
|
|
|
|
|
|
|
build: install vet generate test compile
|
|
|
|
|
2018-09-26 03:49:42 +02:00
|
|
|
compile:
|
2018-09-18 22:42:38 +02:00
|
|
|
go build -v -o ${DIR_BIN}/ferret \
|
|
|
|
-ldflags "-X main.Version=${VERSION}" \
|
2018-10-05 04:13:52 +02:00
|
|
|
./main.go
|
2018-09-18 22:42:38 +02:00
|
|
|
|
|
|
|
install:
|
|
|
|
dep ensure
|
|
|
|
|
|
|
|
test:
|
|
|
|
go test ${DIR_PKG}/...
|
|
|
|
|
|
|
|
generate:
|
2018-09-27 23:03:49 +02:00
|
|
|
go generate ${DIR_PKG}/...
|
2018-09-18 22:42:38 +02:00
|
|
|
|
|
|
|
doc:
|
|
|
|
godoc -http=:6060 -index
|
|
|
|
|
|
|
|
# http://golang.org/cmd/go/#hdr-Run_gofmt_on_package_sources
|
|
|
|
fmt:
|
2018-10-05 04:13:52 +02:00
|
|
|
go fmt ${DIR_CLI}/... ${DIR_PKG}/...
|
2018-09-18 22:42:38 +02:00
|
|
|
|
2018-10-06 00:59:42 +02:00
|
|
|
# https://github.com/mgechev/revive
|
|
|
|
# go get github.com/mgechev/revive
|
2018-09-18 22:42:38 +02:00
|
|
|
lint:
|
2018-10-06 02:56:15 +02:00
|
|
|
revive -config revive.toml -formatter friendly -exclude ./pkg/parser/fql/... -exclude ./vendor/... ./...
|
2018-09-18 22:42:38 +02: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-06 00:59:42 +02:00
|
|
|
go vet ${DIR_CLI}/... ${DIR_PKG}/...
|