From d7b4b51535e1f08757222cf436c5cf6a07e4ca68 Mon Sep 17 00:00:00 2001 From: Manfred Touron <94029+moul@users.noreply.github.com> Date: Tue, 2 Jun 2020 01:58:23 +0200 Subject: [PATCH] fix: bump deps --- go.mod | 1 + go.sum | 2 ++ rules.mk | 33 ++++++++++++++++++++++----------- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index c75b43c..160792a 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,7 @@ go 1.13 require ( github.com/peterbourgon/ff/v3 v3.0.0 github.com/stretchr/testify v1.5.1 + gopkg.in/yaml.v3 v3.0.0-20200601152816-913338de1bd2 // indirect howett.net/plist v0.0.0-20200419221736-3b63eb3a43b5 moul.io/godev v1.6.0 ) diff --git a/go.sum b/go.sum index bfc0255..42fe0d9 100644 --- a/go.sum +++ b/go.sum @@ -32,6 +32,8 @@ gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20190709130402-674ba3eaed22 h1:0efs3hwEZhFKsCoP8l6dDB1AZWMgnEl3yWXWRZTOaEA= gopkg.in/yaml.v3 v3.0.0-20190709130402-674ba3eaed22/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200601152816-913338de1bd2 h1:VEmvx0P+GVTgkNu2EdTN988YCZPcD3lo9AoczZpucwc= +gopkg.in/yaml.v3 v3.0.0-20200601152816-913338de1bd2/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= howett.net/plist v0.0.0-20200419221736-3b63eb3a43b5 h1:AQkaJpH+/FmqRjmXZPELom5zIERYZfwTjnHpfoVMQEc= howett.net/plist v0.0.0-20200419221736-3b63eb3a43b5/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0= moul.io/godev v1.6.0 h1:ms1aI6o9k+PhmMdTR7Aw5iDHPu56xtnmrUgdfLKPspc= diff --git a/rules.mk b/rules.mk index 05c19f8..9ff2c02 100644 --- a/rules.mk +++ b/rules.mk @@ -71,6 +71,7 @@ GOPATH ?= $(HOME)/go GO_INSTALL_OPTS ?= GO_TEST_OPTS ?= -test.timeout=30s GOMOD_DIR ?= . +GOCOVERAGE_FILE ?= ./coverage.txt ifdef GOBINS .PHONY: go.install @@ -91,15 +92,23 @@ endif .PHONY: go.unittest go.unittest: - echo "" > /tmp/coverage.txt - @set -e; for dir in `find $(GOMOD_DIR) -type f -name "go.mod" | grep -v /vendor/ | sed 's@/[^/]*$$@@' | sort | uniq`; do ( set -xe; \ + @echo "mode: atomic" > /tmp/gocoverage + @set -e; for dir in `find $(GOMOD_DIR) -type f -name "go.mod" | grep -v /vendor/ | sed 's@/[^/]*$$@@' | sort | uniq`; do (set -e; (set -xe; \ cd $$dir; \ - $(GO) test $(GO_TEST_OPTS) -cover -coverprofile=/tmp/profile.out -covermode=atomic -race ./...; \ + $(GO) test $(GO_TEST_OPTS) -cover -coverprofile=/tmp/profile.out -covermode=atomic -race ./...); \ if [ -f /tmp/profile.out ]; then \ - cat /tmp/profile.out >> /tmp/coverage.txt; \ + cat /tmp/profile.out | sed "/mode: atomic/d" >> /tmp/gocoverage; \ rm -f /tmp/profile.out; \ fi); done - mv /tmp/coverage.txt . + @mv /tmp/gocoverage $(GOCOVERAGE_FILE) + +.PHONY: go.checkdoc +go.checkdoc: + go doc $(GOMOD_DIR) + +.PHONY: go.coverfunc +go.coverfunc: go.unittest + go tool cover -func=$(GOCOVERAGE_FILE) | grep -v .pb.go: | grep -v .pb.gw.go: .PHONY: go.lint go.lint: @@ -171,6 +180,12 @@ endif ## Docker ## +docker_build = docker build \ + --build-arg VCS_REF=`git rev-parse --short HEAD` \ + --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \ + --build-arg VERSION=`git describe --tags --always` \ + -t "$2" -f "$1" "$(dir $1)" + ifndef DOCKERFILE_PATH DOCKERFILE_PATH = ./Dockerfile endif @@ -183,11 +198,7 @@ ifdef DOCKER_IMAGE ifneq ($(DOCKER_IMAGE),none) .PHONY: docker.build docker.build: - docker build \ - --build-arg VCS_REF=`git rev-parse --short HEAD` \ - --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \ - --build-arg VERSION=`git describe --tags --always` \ - -t $(DOCKER_IMAGE) -f $(DOCKERFILE_PATH) $(dir $(DOCKERFILE_PATH)) + $(call docker_build,$(DOCKERFILE_PATH),$(DOCKER_IMAGE)) BUILD_STEPS += docker.build endif @@ -252,7 +263,7 @@ generate: $(PRE_GENERATE_STEPS) $(GENERATE_STEPS) endif .PHONY: help -help: +help:: @echo "General commands:" @[ "$(BUILD_STEPS)" != "" ] && echo " build" || true @[ "$(BUMPDEPS_STEPS)" != "" ] && echo " bumpdeps" || true