From 48196df4a241dca1b0bd1726c650956c271a6d1b Mon Sep 17 00:00:00 2001 From: Flavio Crisciani Date: Sat, 16 Jun 2018 10:50:38 -0700 Subject: [PATCH] Further makefile cleanup - cleaned the make check - local build do not require context Signed-off-by: Flavio Crisciani --- libnetwork/.circleci/config.yml | 4 ++-- libnetwork/Makefile | 27 +++++++++------------------ libnetwork/networkdb/delegate.go | 2 +- 3 files changed, 12 insertions(+), 21 deletions(-) diff --git a/libnetwork/.circleci/config.yml b/libnetwork/.circleci/config.yml index 493392d3ba..77745d736c 100644 --- a/libnetwork/.circleci/config.yml +++ b/libnetwork/.circleci/config.yml @@ -5,7 +5,7 @@ defaults: &defaults docker: - image: 'circleci/golang:1.10' environment: - Dockerfile: Dockerfile.ci + dockerbuildargs: -f Dockerfile.ci . dockerargs: --privileged -e CIRCLECI jobs: @@ -34,7 +34,7 @@ jobs: - setup_remote_docker: reusable: true exclusive: false - - run: make check-lint + - run: make check cross: <<: *defaults diff --git a/libnetwork/Makefile b/libnetwork/Makefile index d768e0c840..aad6d51d23 100644 --- a/libnetwork/Makefile +++ b/libnetwork/Makefile @@ -1,6 +1,6 @@ -.PHONY: all all-local build build-local clean cross cross-local gosimple vet lint misspell check check-code check-format unit-tests check-local +.PHONY: all all-local build build-local clean cross cross-local gosimple vet lint misspell check check-local check-code check-format unit-tests SHELL=/bin/bash -Dockerfile ?= Dockerfile.build +dockerbuildargs ?= - < Dockerfile.build dockerargs ?= --privileged -v $(shell pwd):/go/src/github.com/docker/libnetwork -w /go/src/github.com/docker/libnetwork build_image=libnetworkbuild container_env = -e "INSIDECONTAINER=-incontainer=true" @@ -9,12 +9,12 @@ CROSS_PLATFORMS = linux/amd64 linux/386 linux/arm windows/amd64 PACKAGES=$(shell go list ./... | grep -v /vendor/) export PATH := $(CURDIR)/bin:$(PATH) -all: ${build_image}.created build check clean +all: build check clean all-local: build-local check-local clean builder: - docker build -f ${Dockerfile} -t ${build_image} . + docker build -t ${build_image} ${dockerbuildargs} build: builder @echo "🐳 $@" @@ -44,14 +44,10 @@ push-images: build-images clean: @echo "🐳 $@" @if [ -d bin ]; then \ - echo "Removing dnet and proxy binaries"; \ + echo "Removing binaries"; \ rm -rf bin; \ fi -force-clean: clean - @echo "🐳 $@" - @rm -rf ${build_image}.created - cross: builder @mkdir -p "bin" @for platform in ${CROSS_PLATFORMS}; do \ @@ -68,12 +64,7 @@ cross-local: check: builder @${docker} make check-local -check-lint: builder - @${docker} make check-local-lint - -check-local-lint: check-format check-code - -check-local: check-format check-code unit-tests-local +check-local: check-code check-format check-code: lint gosimple vet ineffassign @@ -90,7 +81,7 @@ unit-tests-local: if ls $$dir/*.go &> /dev/null; then \ pushd . &> /dev/null ; \ cd $$dir ; \ - go test ${INSIDECONTAINER} -test.v -test.parallel 5 -covermode=count -coverprofile=./profile.tmp ; \ + go test ${INSIDECONTAINER} -test.parallel 5 -test.v -covermode=count -coverprofile=./profile.tmp ; \ ret=$$? ;\ if [ $$ret -ne 0 ]; then exit $$ret; fi ;\ popd &> /dev/null; \ @@ -109,7 +100,7 @@ vet: ## run go vet misspell: @echo "🐳 $@" - @test -z "$$(find . -type f | grep -v vendor/ | grep -v bin/ | grep -v .git/ | grep -v MAINTAINERS | xargs misspell | tee /dev/stderr)" + @test -z "$$(find . -type f | grep -v vendor/ | grep "\.go\|\.md" | xargs misspell -error | tee /dev/stderr)" fmt: ## run go fmt @echo "🐳 $@" @@ -128,5 +119,5 @@ gosimple: ## run gosimple @echo "🐳 $@" @test -z "$$(gosimple . | grep -v vendor/ | grep -v ".pb.go:" | grep -v ".mock.go" | tee /dev/stderr)" -shell: ${build_image}.created +shell: builder @${docker} ${SHELL} diff --git a/libnetwork/networkdb/delegate.go b/libnetwork/networkdb/delegate.go index 9a379fe7cd..6cd827ee26 100644 --- a/libnetwork/networkdb/delegate.go +++ b/libnetwork/networkdb/delegate.go @@ -41,7 +41,7 @@ func (nDB *NetworkDB) handleNodeEvent(nEvent *NodeEvent) bool { // If the node is not known from memberlist we cannot process save any state of it else if it actually // dies we won't receive any notification and we will remain stuck with it if _, ok := nDB.nodes[nEvent.NodeName]; !ok { - logrus.Error("node: %s is unknown to memberlist", nEvent.NodeName) + logrus.Errorf("node: %s is unknown to memberlist", nEvent.NodeName) return false }