SHELL=/usr/bin/env bash
GOVERSION:=$(shell go version | cut -d' ' -f 3 | sed 's/^go//' | awk -F. '{printf "%d%03d%03d", $$1, $$2, $$3}')
ifeq ($(shell expr $(GOVERSION) \< 1015005), 1)
$(warning Your Golang version is go$(shell expr $(GOVERSION) / 1000000).$(shell expr $(GOVERSION) % 1000000 / 1000).$(shell expr $(GOVERSION) % 1000))
$(error Update Golang to version to at least 1.15.5)
endif
VERSION=1.0.0
BUILD=`date +%FT%T%z`
PACKAGES=`go list ./... | grep -v /vendor/`
VETPACKAGES=`go list ./... | grep -v /vendor/ | grep -v /examples/`
GOFILES=`find . -name "*.go" -type f -not -path "./vendor/*"`
all:
@go build -o main
list:
@echo ${PACKAGES}
@echo ${VETPACKAGES}
@echo ${GOFILES}
fmt:
@gofmt -s -w ${GOFILES}
vet:
@go vet $(VETPACKAGES)
clean:
@if [ -f main ] ; then rm main ; fi
.PHONY: all list fmt vet clean
网友评论