Skip to content

Commit

Permalink
Add golangci-lint to CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
macabu committed Dec 17, 2023
1 parent 6c0872b commit 0165df7
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 2 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
Expand All @@ -32,3 +32,8 @@ jobs:

- name: Run tests
run: go test -count=1 -cover -covermode=atomic .

- name: Run linter
uses: golangci/golangci-lint-action@v3
with:
version: 'latest'
33 changes: 33 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
run:
deadline: 30s

linters:
enable-all: true
disable:
- cyclop
- deadcode
- depguard
- exhaustivestruct
- exhaustruct
- forcetypeassert
- gochecknoglobals
- gocognit
- golint
- ifshort
- interfacer
- maligned
- nilnil
- nosnakecase
- paralleltest
- scopelint
- structcheck
- varcheck

linters-settings:
gci:
sections:
- standard
- default
- prefix(github.com/macabu/inamedparam)
section-separators:
- newLine
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ A linter that reports interfaces with unnamed method parameters.
## Usage

### Standalone
You can also run it standalone through `go vet`.
You can run it standalone through `go vet`.

You must install the binary to your `$GOBIN` folder like so:
```sh
Expand All @@ -16,3 +16,17 @@ And then navigate to your Go project's root folder, where can run `go vet` in th
```sh
$ go vet -vettool=$(which inamedparam) ./...
```

### golangci-lint
`inamedparam` was added as a linter to `golangci-lint` on version `v1.55.0`. It is disabled by default.

To enable it, you can add it to your `.golangci.yml` file, as such:
```yaml
run:
deadline: 30s

linters:
disable-all: true
enable:
- inamedparam
```

0 comments on commit 0165df7

Please sign in to comment.