From 12f949758b892ece8dd202ff1023a0eb3a8a144e Mon Sep 17 00:00:00 2001 From: ffranr Date: Tue, 24 Jan 2023 16:11:02 +0000 Subject: [PATCH] lint: use linter from aperture-tools docker image --- Makefile | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 91286a0..29c7171 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,13 @@ PKG := github.com/lightninglabs/aperture ESCPKG := github.com\/lightninglabs\/aperture +TOOLS_DIR := tools -LINT_PKG := github.com/golangci/golangci-lint/cmd/golangci-lint GOVERALLS_PKG := github.com/mattn/goveralls GOACC_PKG := github.com/ory/go-acc GO_BIN := ${GOPATH}/bin GOVERALLS_BIN := $(GO_BIN)/goveralls -LINT_BIN := $(GO_BIN)/golangci-lint GOACC_BIN := $(GO_BIN)/go-acc - -LINT_COMMIT := v1.18.0 GOACC_COMMIT := ddc355013f90fea78d83d3a6c71f1d37ac07ecd5 DEPGET := cd /tmp && GO111MODULE=on go get -v @@ -29,7 +26,9 @@ XARGS := xargs -L 1 include make/testing_flags.mk -LINT = $(LINT_BIN) run -v +# DOCKER_TOOLS is a docker run command which executes the +# aperture tools (e.g. linting) docker image. +DOCKER_TOOLS = docker run -v $$(pwd):/build aperture-tools default: build @@ -43,10 +42,6 @@ $(GOVERALLS_BIN): @$(call print, "Fetching goveralls.") go get -u $(GOVERALLS_PKG) -$(LINT_BIN): - @$(call print, "Fetching linter") - $(DEPGET) $(LINT_PKG)@$(LINT_COMMIT) - $(GOACC_BIN): @$(call print, "Fetching go-acc") $(DEPGET) $(GOACC_PKG)@$(GOACC_COMMIT) @@ -63,6 +58,10 @@ install: @$(call print, "Installing aperture.") $(GOINSTALL) $(PKG)/cmd/aperture +docker-tools: + @$(call print, "Building tools docker image.") + docker build -q -t aperture-tools $(TOOLS_DIR) + # ======= # TESTING # ======= @@ -101,9 +100,9 @@ fmt: @$(call print, "Formatting source.") gofmt -l -w -s $(GOFILES_NOVENDOR) -lint: $(LINT_BIN) +lint: docker-tools @$(call print, "Linting source.") - $(LINT) + $(DOCKER_TOOLS) golangci-lint run -v list: @$(call print, "Listing commands.")