mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-04 09:48:19 +01:00
Merge pull request #6248 from guggero/lint-dockerize
make+tools: dockerize linting [skip ci]
This commit is contained in:
commit
2891dc7399
2 changed files with 23 additions and 9 deletions
16
Makefile
16
Makefile
|
@ -4,7 +4,6 @@ MOBILE_PKG := $(PKG)/mobile
|
||||||
TOOLS_DIR := tools
|
TOOLS_DIR := tools
|
||||||
|
|
||||||
BTCD_PKG := github.com/btcsuite/btcd
|
BTCD_PKG := github.com/btcsuite/btcd
|
||||||
LINT_PKG := github.com/golangci/golangci-lint/cmd/golangci-lint
|
|
||||||
GOACC_PKG := github.com/ory/go-acc
|
GOACC_PKG := github.com/ory/go-acc
|
||||||
GOIMPORTS_PKG := github.com/rinchsan/gosimports/cmd/gosimports
|
GOIMPORTS_PKG := github.com/rinchsan/gosimports/cmd/gosimports
|
||||||
GOFUZZ_BUILD_PKG := github.com/dvyukov/go-fuzz/go-fuzz-build
|
GOFUZZ_BUILD_PKG := github.com/dvyukov/go-fuzz/go-fuzz-build
|
||||||
|
@ -15,7 +14,6 @@ GO_BIN := ${GOPATH}/bin
|
||||||
BTCD_BIN := $(GO_BIN)/btcd
|
BTCD_BIN := $(GO_BIN)/btcd
|
||||||
GOIMPORTS_BIN := $(GO_BIN)/gosimports
|
GOIMPORTS_BIN := $(GO_BIN)/gosimports
|
||||||
GOMOBILE_BIN := GO111MODULE=off $(GO_BIN)/gomobile
|
GOMOBILE_BIN := GO111MODULE=off $(GO_BIN)/gomobile
|
||||||
LINT_BIN := $(GO_BIN)/golangci-lint
|
|
||||||
GOACC_BIN := $(GO_BIN)/go-acc
|
GOACC_BIN := $(GO_BIN)/go-acc
|
||||||
GOFUZZ_BUILD_BIN := $(GO_BIN)/go-fuzz-build
|
GOFUZZ_BUILD_BIN := $(GO_BIN)/go-fuzz-build
|
||||||
GOFUZZ_BIN := $(GO_BIN)/go-fuzz
|
GOFUZZ_BIN := $(GO_BIN)/go-fuzz
|
||||||
|
@ -70,7 +68,7 @@ ifneq ($(workers),)
|
||||||
LINT_WORKERS = --concurrency=$(workers)
|
LINT_WORKERS = --concurrency=$(workers)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LINT = $(LINT_BIN) run -v $(LINT_WORKERS)
|
DOCKER_TOOLS = docker run -v $$(pwd):/build lnd-tools
|
||||||
|
|
||||||
GREEN := "\\033[0;32m"
|
GREEN := "\\033[0;32m"
|
||||||
NC := "\\033[0m"
|
NC := "\\033[0m"
|
||||||
|
@ -85,10 +83,6 @@ all: scratch check install
|
||||||
# ============
|
# ============
|
||||||
# DEPENDENCIES
|
# DEPENDENCIES
|
||||||
# ============
|
# ============
|
||||||
$(LINT_BIN):
|
|
||||||
@$(call print, "Installing linter.")
|
|
||||||
cd $(TOOLS_DIR); go install -trimpath -tags=tools $(LINT_PKG)
|
|
||||||
|
|
||||||
$(GOACC_BIN):
|
$(GOACC_BIN):
|
||||||
@$(call print, "Installing go-acc.")
|
@$(call print, "Installing go-acc.")
|
||||||
cd $(TOOLS_DIR); go install -trimpath -tags=tools $(GOACC_PKG)
|
cd $(TOOLS_DIR); go install -trimpath -tags=tools $(GOACC_PKG)
|
||||||
|
@ -165,6 +159,10 @@ docker-release:
|
||||||
# that we might want to overwrite in manual tests.
|
# that we might want to overwrite in manual tests.
|
||||||
$(DOCKER_RELEASE_HELPER) make release tag="$(tag)" sys="$(sys)" COMMIT="$(COMMIT)" COMMIT_HASH="$(COMMIT_HASH)"
|
$(DOCKER_RELEASE_HELPER) make release tag="$(tag)" sys="$(sys)" COMMIT="$(COMMIT)" COMMIT_HASH="$(COMMIT_HASH)"
|
||||||
|
|
||||||
|
docker-tools:
|
||||||
|
@$(call print, "Building tools docker image.")
|
||||||
|
docker build -q -t lnd-tools $(TOOLS_DIR)
|
||||||
|
|
||||||
scratch: build
|
scratch: build
|
||||||
|
|
||||||
|
|
||||||
|
@ -260,9 +258,9 @@ fmt: $(GOIMPORTS_BIN)
|
||||||
@$(call print, "Formatting source.")
|
@$(call print, "Formatting source.")
|
||||||
gofmt -l -w -s $(GOFILES_NOVENDOR)
|
gofmt -l -w -s $(GOFILES_NOVENDOR)
|
||||||
|
|
||||||
lint: $(LINT_BIN)
|
lint: docker-tools
|
||||||
@$(call print, "Linting source.")
|
@$(call print, "Linting source.")
|
||||||
$(LINT)
|
$(DOCKER_TOOLS) golangci-lint run -v $(LINT_WORKERS)
|
||||||
|
|
||||||
list:
|
list:
|
||||||
@$(call print, "Listing commands.")
|
@$(call print, "Listing commands.")
|
||||||
|
|
16
tools/Dockerfile
Normal file
16
tools/Dockerfile
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
FROM golang:1.17.3-buster
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y git
|
||||||
|
ENV GOCACHE=/tmp/build/.cache
|
||||||
|
ENV GOMODCACHE=/tmp/build/.modcache
|
||||||
|
|
||||||
|
COPY . /tmp/tools
|
||||||
|
|
||||||
|
RUN cd /tmp \
|
||||||
|
&& mkdir -p /tmp/build/.cache \
|
||||||
|
&& mkdir -p /tmp/build/.modcache \
|
||||||
|
&& cd /tmp/tools \
|
||||||
|
&& go install -trimpath -tags=tools github.com/golangci/golangci-lint/cmd/golangci-lint \
|
||||||
|
&& chmod -R 777 /tmp/build/
|
||||||
|
|
||||||
|
WORKDIR /build
|
Loading…
Add table
Reference in a new issue