Skip to content

Commit

Permalink
Add lint to CI
Browse files Browse the repository at this point in the history
Note: `go mod download` is needed since we don't have vendor, and on a
clean system `golangci-lint` won't be able to find the dependent
packages.

`go mod download` is not required for `go test` since the latter runs it
automatically.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
  • Loading branch information
kolyshkin committed Mar 17, 2020
1 parent d73860a commit 4a24c04
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ jobs:
uses: actions/checkout@v2
- name: Test
run: make test
- name: Lint
run: make lint
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
PACKAGES ?= mountinfo mount
BINDIR ?= _build/bin

.PHONY: all
all: lint test

.PHONY: test
test:
for p in $(PACKAGES); do \
(cd $$p && go test -v .); \
done

.PHONY: lint
lint: $(BINDIR)/golangci-lint
$(BINDIR)/golangci-lint version
for p in $(PACKAGES); do \
(cd $$p && go mod download \
&& ../$(BINDIR)/golangci-lint run); \
done

$(BINDIR)/golangci-lint: $(BINDIR)
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(BINDIR) v1.24.0

$(BINDIR):
mkdir -p $(BINDIR)

0 comments on commit 4a24c04

Please sign in to comment.