Skip to content

Commit

Permalink
tools+.: add custom linter configuration file
Browse files Browse the repository at this point in the history
Add this file both to the main LND directory so that devs can use it for
local linter runs and also add it to the `tools` directory so that the
docker environment used to run the linter in CI has access to it. A
custom linter binary can be built via `golangci-lint custom`. This will
pull in and register all the plugins listed in the new config file when
building the new binary. The new binary can then be run using
`custom-gcl run`.
  • Loading branch information
ellemouton committed Nov 29, 2024
1 parent 146ca93 commit 3200d95
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .custom-gcl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
version: v1.57.0
plugins:
- module: 'github.com/lightningnetwork/lnd/tools/linters'
path: ./tools/linters
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ check-go-version: check-go-version-dockerfile check-go-version-yaml
#? lint-source: Run static code analysis
lint-source: docker-tools
@$(call print, "Linting source.")
$(DOCKER_TOOLS) golangci-lint run -v $(LINT_WORKERS)
$(DOCKER_TOOLS) custom-gcl run -v $(LINT_WORKERS)

#? lint: Run static code analysis
lint: check-go-version lint-source
Expand Down
4 changes: 4 additions & 0 deletions tools/.custom-gcl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
version: v1.57.0
plugins:
- module: 'github.com/lightningnetwork/lnd/tools/linters'
path: ./linters
2 changes: 2 additions & 0 deletions tools/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ RUN cd /tmp \
&& mkdir -p /tmp/build/.modcache \
&& cd /tmp/tools \
&& go install -trimpath github.com/golangci/golangci-lint/cmd/golangci-lint \
&& golangci-lint custom \
&& mv ./custom-gcl /usr/local/bin/custom-gcl \
&& chmod -R 777 /tmp/build/ \
&& git config --global --add safe.directory /build

Expand Down

0 comments on commit 3200d95

Please sign in to comment.