File tree Expand file tree Collapse file tree 2 files changed +23
-4
lines changed Expand file tree Collapse file tree 2 files changed +23
-4
lines changed Original file line number Diff line number Diff line change 13
13
14
14
env :
15
15
GO_VERSION : 1.22
16
- # see https://golangci-lint.run/product/changelog
17
- # to select a version that supports the GO_VERSION given above
18
- GOLANGCI_LINT_VERSION : v2.0.2
19
16
20
17
concurrency :
21
18
group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -44,10 +41,14 @@ jobs:
44
41
- name : Install libgpgme devel package
45
42
run : sudo apt install -y libgpgme-dev libbtrfs-dev libdevmapper-dev
46
43
44
+ - name : Extract golangci-lint version from Makefile
45
+ id : golangci_lint_version
46
+ run : echo "GOLANGCI_LINT_VERSION=$(awk -F '=' '/^GOLANGCI_LINT_VERSION *=/{print $2}' Makefile)" >> "$GITHUB_OUTPUT"
47
+
47
48
- name : Run golangci-lint
48
49
uses : golangci/golangci-lint-action@v7
49
50
with :
50
- version : ${{ env .GOLANGCI_LINT_VERSION }}
51
+ version : ${{ steps.golangci_lint_version.outputs .GOLANGCI_LINT_VERSION }}
51
52
args : --timeout 5m0s
52
53
working-directory : bib
53
54
Original file line number Diff line number Diff line change 1
1
.PHONY : all
2
2
all : build-binary build-container
3
3
4
+ GOLANGCI_LINT_VERSION =v2.0.2
5
+ GO_BINARY? =go
6
+
7
+ # the fallback '|| echo "golangci-lint' really expects this file
8
+ # NOT to exist! This is just a trigger to help installing golangci-lint
9
+ GOLANGCI_LINT_BIN =$(shell which golangci-lint 2>/dev/null || echo "golangci-lint")
10
+
4
11
.PHONY : help
5
12
help :
6
13
@echo ' Usage:'
@@ -45,3 +52,14 @@ push-check: build-binary build-container test ## run all checks and tests befor
45
52
exit 1; \
46
53
fi
47
54
@echo " All looks good - congratulations"
55
+
56
+ $(GOLANGCI_LINT_BIN ) :
57
+ @echo " golangci-lint does not seem to be installed"
58
+ @read -p " Press <ENTER> to install it or <CTRL>-c to abort"
59
+ $(GO_BINARY ) install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION ) || \
60
+ ( echo " if the go version is a problem, you can set GO_BINARY e.g. GO_BINARY=go.1.23.8 \
61
+ after installing it e.g. go install golang.org/dl/go1.23.8@latest" ; exit 1 )
62
+
63
+ .PHONY : lint
64
+ lint : $(GOLANGCI_LINT_BIN ) # # run the linters to check for bad code
65
+ cd bib && $(GOLANGCI_LINT_BIN ) run
You can’t perform that action at this time.
0 commit comments