PKG_LIST:=$(shell go list ${PKG}/... | grep-v /vendor/)
STATIC_OUT:=${OUT}-v${VERSION}
PACKAGE_PATH:= dist/${OUT}-${VERSION}
ifndefPACKAGE_PATH
# ${PACKAGE_PATH} is used in 'rm' commands, so it's important to check.
$(errorPACKAGE_PATHisnotset)
endif
all:binary
binary:
go build -i-v-o${OUT}-ldflags="-X main.applicationVersion=${VERSION}"${PKG}
install:
go install-i-v-ldflags="-X main.applicationVersion=${VERSION}"${PKG}
version:
@echo"Package: ${PKG}"
@echo"Version: ${VERSION}"
test:
go test-short${PKG_LIST}
vet:
@go vet ${PKG_LIST}
lint:
@for file in${GO_FILES};do\
golint $$file ;\
done
run:binary
./${OUT}
clean:
@go clean -i-x
rm-f${OUT}-v*
static:vet lint
go build -i-v-o${STATIC_OUT}-tags netgo -ldflags="-extldflags \"-static\" -w -s -X main.applicationVersion=${VERSION}"${PKG}
.gitlabAccessToken:
$(error gitlabAccessToken does not exist, visit Visit https://gitlab.com/profile/personal_access_tokens, create a Personal Access Token with API access then save it to the file .gitlabAccessToken)