Skip to content

Commit

Permalink
ci: add linting to makefile and ci
Browse files Browse the repository at this point in the history
  • Loading branch information
shoenig committed Aug 25, 2024
1 parent 25fa7cc commit b6ae5b2
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
45 changes: 45 additions & 0 deletions .github/workflows/scripts/golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
run:
timeout: 5m
linters:
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- dogsled
- dupword
- durationcheck
- errcheck
- errname
- errorlint
- exhaustive
- gochecknoinits
- gocritic
- gofmt
- gosimple
- govet
- ineffassign
- makezero
- misspell
- musttag
- nilnil
- noctx
- paralleltest
- perfsprint
- prealloc
- predeclared
- reassign
- revive
- rowserrcheck
- staticcheck
- sqlclosecheck
- tagalign
- tenv
- unused
- whitespace

linters-settings:
paralleltest:
ignore-missing-subtests: true
exhaustive:
default-signifies-exhaustive: true
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ test: vet
@echo "--> Running Tests ..."
@go test -v -race ./...

.PHONY: lint
lint: vet
@echo "--> Linting Go sources ..."
@golangci-lint run --config .github/workflows/scripts/golangci.yaml

.PHONY: vet
vet:
@echo "--> Vet Go sources ..."
Expand Down
8 changes: 7 additions & 1 deletion lockdown_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,11 @@ func lockdown(directory string) {
ll := landlock.New(
landlock.Dir(directory, "rwc"),
)
ll.Lock(landlock.Mandatory)
assert(ll.Lock(landlock.Mandatory))
}

func assert(err error) {
if err != nil {
panic(err)
}
}

0 comments on commit b6ae5b2

Please sign in to comment.