You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

49 lines
1.2 KiB

-include .env
export PATH := $($(GO) env GOPATH)/bin:$(PATH)
VERSION := $(shell git describe --long --always)
PROJECTNAME := $(shell basename "$(PWD)")
PROJECTDESC := $(shell echo "Rest API Skeleton")
LDFLAGS=-ldflags "-w -s -X 'main.Version=$(VERSION)' -X 'main.APPName=$(PROJECTNAME)' -X 'main.APPDescription=$(PROJECTDESC)'"
# MAKEFLAGS += --silent
GOCMD := go
GOBUILD := $(GOCMD) build
GOCLEAN := $(GOCMD) clean
GOTEST := $(GOCMD) test -timeout 360s -cover
GOINSTALL := $(GOCMD) install
GOGET := $(GOCMD) mod download
all: test build
build:
@echo " > Building binary..."
$(GOBUILD) $(LDFLAGS) -o $(PROJECTNAME) -v
test:
$(GOTEST) ./...
clean:
$(GOCLEAN)
rm -f gin-bin
rm -f $(PROJECTNAME)
run:
$(GOBUILD) $(LDFLAGS) -o $(PROJECTNAME) -v ./...
./$(PROJECTNAME)
deps:
$(GOGET)
install:
@echo " > Not yet implemented..."
lint:
@hash golangci-lint > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
export BINARY="golangci-lint"; \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.32.2; \
fi
golangci-lint --color=always run --timeout 5m
.PHONY: all build test clean run deps install lint