Skip to content

Commit

Permalink
Add golangci-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
silas committed Feb 24, 2024
1 parent c02c1c9 commit bcb28d0
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 2 deletions.
21 changes: 20 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

Expand All @@ -36,3 +36,22 @@ jobs:

- name: Test
run: make test

golangci-lint:
name: golangci-lint
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.22
cache: false

- name: GolangCI
uses: golangci/golangci-lint-action@v4
with:
version: v1.56.2
44 changes: 44 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
run:
timeout: 5m

linters-settings:
errcheck:
check-type-assertions: true

forbidigo:
forbid:
- ^print.*$
- 'fmt\.Print.*'

gci:
sections:
- standard
- default
- prefix(github.com/userhubdev/go-sdk)
- blank
- dot
custom-order: true

gofmt:
rewrite-rules:
- pattern: 'interface{}'
replacement: 'any'

govet:
enable-all: true
disable:
- fieldalignment

linters:
enable:
- errcheck
- forbidigo
- gci
- gofmt
- goimports
- govet
- misspell
- nilnil
- perfsprint
- unconvert
- whitespace
2 changes: 1 addition & 1 deletion internal/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (r *Request) SetHeader(name, value string) {
if r.headers == nil {
r.headers = http.Header{}
}
r.SetHeader(name, value)
r.headers.Set(name, value)
}

func (r *Request) SetIdempotent(v bool) {
Expand Down

0 comments on commit bcb28d0

Please sign in to comment.