Skip to content

Commit

Permalink
feat: add golangci-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
bschaatsbergen committed Dec 3, 2023
1 parent 2c56d21 commit 2a928e1
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 4 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ jobs:
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: Generate
run: go generate -v ./...
cache: true
- name: Build
run: go build -v ./...
- name: Test
- name: Run linters
uses: golangci/golangci-lint-action@v3
with:
version: latest
- name: Run tests
run: go test -v ./...
27 changes: 27 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Visit https://golangci-lint.run/ for usage documentation
# and information on other useful linters
issues:
max-per-linter: 0
max-same-issues: 0

linters:
disable-all: true
enable:
- durationcheck
- errcheck
- exportloopref
- forcetypeassert
- godot
- gofmt
- gosimple
- ineffassign
- makezero
- misspell
- nilerr
- predeclared
- staticcheck
- tenv
- unconvert
- unparam
- unused
- vet
6 changes: 5 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ var (
Short: "cidr - CLI to perform various actions on CIDR ranges",
Version: version, // The version is set during the build by making using of `go build -ldflags`
Run: func(cmd *cobra.Command, args []string) {
cmd.Help()
err := cmd.Help()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
},
}
)
Expand Down

0 comments on commit 2a928e1

Please sign in to comment.