Skip to content

Commit 3fc6e0e

Browse files
committed
ci: don't install private golangci-lint
First, let's not install golangci-lint from Makefile, instead relying on whatever version a developer already has installed and available. Second, we still need golangci-lint in GHA CI. For that, let's use golangci-lint-action. Unfortunately, there's no way to NOT run it from the action, or run it on multiple directories (see [1]), so run it on a single module. This is better for CI because we use all the good bits from the golangci-lint-action (caching and annotations). While at it, bump golangci-lint from v2.0.3 to v2.4.x. [1]: golangci/golangci-lint-action#1226 Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent 7e71ac0 commit 3fc6e0e

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

.github/workflows/test.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ jobs:
2121
# the cache key, and specifying multiple go.sums is not trivial
2222
# (see https://github.com/moby/sys/pull/160 for details).
2323
cache: false
24+
- name: Install golangci-lint
25+
uses: golangci/golangci-lint-action@v8
26+
with:
27+
version: v2.4
28+
# We don't need to run golangci-lint here yet, but
29+
# there's no way to avoid it, so run it on one module.
30+
working-directory: ./mountinfo
2431
- name: Set PACKAGES env
2532
if: ${{ matrix.go-version == '1.18.x' }}
2633
run: |

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
/_build/
21
/mount/go-local.*
32
coverage.txt

Makefile

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
PACKAGES ?= atomicwriter capability mountinfo mount reexec sequential signal symlink user userns
2-
BINDIR ?= _build/bin
32
CROSS ?= linux/arm linux/arm64 linux/ppc64le linux/s390x \
43
freebsd/amd64 openbsd/amd64 darwin/amd64 darwin/arm64 windows/amd64
54
SUDO ?= sudo -n
@@ -47,18 +46,14 @@ test-local:
4746
cd atomicwriter && go mod tidy $(MOD) && go test $(MOD) $(RUN_VIA_SUDO) -v .
4847
$(RM) atomicwriter/go-local.*
4948

49+
.PHONY: golangci-lint-version
50+
golangci-lint-version:
51+
golangci-lint version
52+
5053
.PHONY: lint
51-
lint: $(BINDIR)/golangci-lint
52-
lint: CMD=go mod download; ../$(BINDIR)/golangci-lint run
54+
lint: golangci-lint-version
55+
lint: CMD=go mod download; golangci-lint run
5356
lint: foreach
54-
lint:
55-
$(BINDIR)/golangci-lint version
56-
57-
$(BINDIR)/golangci-lint: $(BINDIR)
58-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(BINDIR) v2.0.2
59-
60-
$(BINDIR):
61-
mkdir -p $(BINDIR)
6257

6358
.PHONY: cross
6459
cross:

0 commit comments

Comments
 (0)