Skip to content

Commit 5d58379

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.3.1. [1]: golangci/golangci-lint-action#1226 Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
1 parent 6b0a691 commit 5d58379

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

.github/workflows/test.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ 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.3
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+
# Using reexec as it works with go 1.18 and doesn't require other modules.
31+
working-directory: ./reexec
2432
- name: Set PACKAGES env
2533
if: ${{ matrix.go-version == '1.18.x' }}
2634
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: 2 additions & 10 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 # IMPORTANT: when updating this list, also update the conditional one in .github/workflows/test.yml
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
@@ -48,17 +47,10 @@ test-local:
4847
$(RM) atomicwriter/go-local.*
4948

5049
.PHONY: lint
51-
lint: $(BINDIR)/golangci-lint
52-
lint: CMD=go mod download; ../$(BINDIR)/golangci-lint run
50+
lint: CMD=go mod download; golangci-lint run
5351
lint: foreach
5452
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)
53+
golangci-lint version
6254

6355
.PHONY: cross
6456
cross:

0 commit comments

Comments
 (0)