2018-11-12 16:46:35 +01:00
|
|
|
#! /usr/bin/make
|
|
|
|
GOCMD=$(shell which go)
|
|
|
|
GOLINT=$(shell which golint)
|
|
|
|
GOIMPORT=$(shell which goimports)
|
|
|
|
GOBUILD=$(GOCMD) build
|
|
|
|
GOCLEAN=$(GOCMD) clean
|
|
|
|
GOTEST=$(GOCMD) test
|
|
|
|
GOGET=$(GOCMD) get
|
|
|
|
GOLIST=$(GOCMD) list
|
|
|
|
BINARY_NAME=swag
|
2018-12-21 22:30:43 +01:00
|
|
|
PACKAGES=$(shell $(GOLIST) -f {{.Dir}} ./... | grep -v /example)
|
2018-11-12 16:46:35 +01:00
|
|
|
|
|
|
|
all: test build
|
|
|
|
|
|
|
|
build:
|
|
|
|
$(GOBUILD) -o $(BINARY_NAME) -v ./cmd/...
|
|
|
|
|
|
|
|
test:
|
|
|
|
$(GOTEST) -v ./...
|
|
|
|
|
|
|
|
clean:
|
|
|
|
$(GOCLEAN)
|
|
|
|
rm -f $(BINARY_NAME)
|
|
|
|
|
|
|
|
lint:
|
2018-12-21 22:30:43 +01:00
|
|
|
for PKG in $(PACKAGES); do golint -set_exit_status $$PKG || exit 1; done;
|
2018-11-12 16:46:35 +01:00
|
|
|
|
|
|
|
deps:
|
|
|
|
$(GOGET) -v ./...
|
|
|
|
$(GOGET) github.com/stretchr/testify/assert
|
|
|
|
$(GOGET) golang.org/x/lint/golint
|
|
|
|
$(GOGET) golang.org/x/tools/cmd/goimports
|
|
|
|
|
|
|
|
view-covered:
|
|
|
|
$(GOTEST) -coverprofile=cover.out $(TARGET)
|
|
|
|
$(GOCMD) tool cover -html=cover.out
|