Skip to content

Commit c5b4090

Browse files
committed
Improve golangci-lint setup
1 parent dc6af49 commit c5b4090

4 files changed

Lines changed: 28 additions & 7 deletions

File tree

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
---
22
name: golangci-lint
3-
on: pull_request
3+
on:
4+
pull_request:
45
permissions:
56
contents: read
67
pull-requests: write
78
jobs:
89
golangci:
9-
name: lint
10+
name: Lint
1011
runs-on: ubuntu-24.04
1112
steps:
1213
- uses: actions/checkout@v6
14+
- name: Setup Go
15+
uses: arnested/setup-go@rc
16+
with:
17+
go-version-file: go.mod
1318
- name: golangci-lint
1419
uses: golangci/golangci-lint-action@v9
1520
with:
1621
version: latest
22+
install-mode: goinstall
1723
only-new-issues: true

.golangci.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,25 @@ linters:
55
disable:
66
- depguard
77
- exhaustruct
8+
- tagliatelle
9+
- wsl
10+
settings:
11+
errcheck:
12+
check-type-assertions: true
13+
check-blank: true
14+
exhaustive:
15+
default-signifies-exhaustive: true
816
exclusions:
917
generated: lax
1018
presets:
1119
- comments
1220
- common-false-positives
1321
- legacy
1422
- std-error-handling
23+
rules:
24+
- linters:
25+
- ifshort
26+
path: _test\.go
1527
paths:
1628
- third_party$
1729
- builtin$

event.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,18 @@ func listen(containers Containers, since time.Time, timeout time.Duration, failO
5656
return false, err
5757
case msg := <-msgs:
5858
container := Container{
59-
Status: msg.Status[15:],
59+
Status: string(msg.Action)[15:],
6060
Changed: time.Unix(msg.Time, msg.TimeNano),
6161
}
6262

63-
containers.Add(msg.ID, container)
63+
containers.Add(msg.Actor.ID, container)
6464

6565
if containers.Healthy() {
6666
return true, nil
6767
}
6868

69-
if err := containers.Unhealthy(); err != nil && failOnUnhealthy {
69+
err := containers.Unhealthy()
70+
if err != nil && failOnUnhealthy {
7071
return false, err
7172
}
7273
case <-timeoutChan:

main.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,13 @@ func main() {
4848
os.Exit(0)
4949
}
5050

51-
if err := containers.Unhealthy(); err != nil && *failOnUnhealthy {
51+
err = containers.Unhealthy()
52+
if err != nil && *failOnUnhealthy {
5253
fail(err)
5354
}
5455

55-
if _, err := listen(containers, since, *timeout, *failOnUnhealthy); err != nil {
56+
_, err = listen(containers, since, *timeout, *failOnUnhealthy)
57+
if err != nil {
5658
fail(err)
5759
}
5860
}

0 commit comments

Comments
 (0)