From 89b6e8bce78f2a060c56c1e61edc0e3b47e5ab34 Mon Sep 17 00:00:00 2001 From: Russ Magee Date: Thu, 30 Jan 2020 12:40:18 -0800 Subject: [PATCH] Version tags now reflect mod/vendor build setup. Switched 'make lint' to use golangci-lint as gometalinter is deprecated. Signed-off-by: Russ Magee --- Makefile | 22 ++++++++++++++-------- xs/Makefile | 2 +- xsd/Makefile | 2 +- xspasswd/Makefile | 2 +- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 034f101..efcd2c8 100644 --- a/Makefile +++ b/Makefile @@ -1,22 +1,28 @@ .PHONY: lint vis clean common client server passwd subpkgs install uninstall reinstall -#ifeq ($(MAKEOPTS),) - MAKEOPTS = $(MAKEOPTS) -#endif - -GIT_COMMIT := $(shell git rev-list -1 HEAD) -VERSION := 0.8.12 +## Tag version of binaries with build info wrt. +## GO111MODULE(=on) and vendor/ setup vs. $GOPATH pkg builds +############################################################ +ifeq ($(shell go env GOMOD),) +MTAG= +else +MTAG="-m" +endif ifneq ($(VENDOR),) GOBUILDOPTS :=-v -mod vendor -VTAG = "-vendor" +VTAG = "-v" else GOBUILDOPTS= VTAG = endif +############################################################ + +GIT_COMMIT := $(shell git rev-list -1 HEAD) +VERSION := 0.8.12 #ifeq ($(BUILDOPTS),) -BUILDOPTS :=$(BUILDOPTS)"$(GOBUILDOPTS) -ldflags \"-X main.version=$(VERSION)$(VTAG) -X main.gitCommit=$(GIT_COMMIT)\"" +BUILDOPTS :=$(BUILDOPTS)"$(GOBUILDOPTS) -ldflags \"-X main.version=$(VERSION)$(MTAG)$(VTAG) -X main.gitCommit=$(GIT_COMMIT)\"" #endif SUBPKGS = logger spinsult xsnet diff --git a/xs/Makefile b/xs/Makefile index 9527cea..c3f582b 100644 --- a/xs/Makefile +++ b/xs/Makefile @@ -15,4 +15,4 @@ vis: ../fixup-gv.sh xs.go && cat xs-vis.gv | dot -Tpng -oxs-vis-fixedup.png lint: - -gometalinter --deadline=60s | sort + -golangci-lint run diff --git a/xsd/Makefile b/xsd/Makefile index f36bc82..deef212 100644 --- a/xsd/Makefile +++ b/xsd/Makefile @@ -14,5 +14,5 @@ vis: ../fixup-gv.sh xsd.go && cat xsd-vis.gv | dot -Tpng -oxsd-vis-fixedup.png lint: - -gometalinter --deadline=60s | sort + -golangci-lint run diff --git a/xspasswd/Makefile b/xspasswd/Makefile index 99e709b..1f8e2c6 100644 --- a/xspasswd/Makefile +++ b/xspasswd/Makefile @@ -13,4 +13,4 @@ vis: go-callvis -format png -file xspasswd-vis -ignore $(EXTPKGS) -group pkg,type . lint: - -gometalinter --deadline=60s | sort + -golangci-lint run