Skip to content

Commit 66b0bb1

Browse files
authored
Merge pull request #190 from Luap99/lint
Gh action and golangci-lint updates
2 parents 533b50b + 047ae97 commit 66b0bb1

8 files changed

Lines changed: 29 additions & 22 deletions

File tree

.github/workflows/validate.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,29 @@ on:
88
- release-*
99
pull_request:
1010

11-
jobs:
11+
env:
12+
LINT_VERSION: v2.6.1
1213

14+
jobs:
1315
lint:
14-
runs-on: ubuntu-22.04
16+
runs-on: ubuntu-24.04
1517
steps:
16-
- uses: actions/checkout@v4
18+
- uses: actions/checkout@v5
1719
with:
1820
fetch-depth: 2
19-
- uses: actions/setup-go@v5
21+
- uses: actions/setup-go@v6
2022
- name: lint
21-
uses: golangci/golangci-lint-action@v4
23+
uses: golangci/golangci-lint-action@v8
2224
with:
2325
version: "${{ env.LINT_VERSION }}"
2426
args: --verbose
2527

2628
codespell:
27-
runs-on: ubuntu-22.04
29+
runs-on: ubuntu-24.04
2830
steps:
29-
- uses: actions/checkout@v4
31+
- uses: actions/checkout@v5
3032
- name: install deps
3133
# Version of codespell bundled with Ubuntu is way old, so use pip.
32-
run: pip install codespell
34+
run: pip install --break-system-packages codespell
3335
- name: run codespell
3436
run: codespell --dictionary=-

.golangci.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
# For documentation, see https://golangci-lint.run/usage/configuration/
2-
1+
version: "2"
32
linters:
43
enable:
54
- errorlint
5+
formatters:
6+
enable:
67
- gofumpt
8+
9+
# Show all issues at once so it is visible how much must be fixed
10+
issues:
11+
max-issues-per-linter: 0
12+
max-same-issues: 0

internal/dev/tty.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func TTYs() (*[]TTY, error) {
7373
if err != nil {
7474
return nil, err
7575
}
76-
defer devDir.Close()
76+
defer devDir.Close() //nolint:errcheck
7777

7878
devices := []string{}
7979
devTTYs, err := devDir.Readdirnames(0)
@@ -91,7 +91,7 @@ func TTYs() (*[]TTY, error) {
9191
if err != nil {
9292
return nil, err
9393
}
94-
defer devPTSDir.Close()
94+
defer devPTSDir.Close() //nolint:errcheck
9595

9696
devPTSs, err := devPTSDir.Readdirnames(0)
9797
if err != nil {

internal/host/host_nocgo.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//go:build !cgo
2-
// +build !cgo
32

43
// Copyright 2018 psgo authors
54
//

internal/proc/ns.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func ReadMappings(path string) ([]idtools.IDMap, error) {
4747
if err != nil {
4848
return nil, err
4949
}
50-
defer file.Close()
50+
defer file.Close() //nolint:errcheck
5151

5252
var mappings []idtools.IDMap
5353

internal/proc/pids.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func GetPIDs() ([]string, error) {
3131
if err != nil {
3232
return nil, err
3333
}
34-
defer procDir.Close()
34+
defer procDir.Close() //nolint:errcheck
3535

3636
// extract string slice of all directories in procDir
3737
pidDirs, err := procDir.Readdirnames(0)
@@ -74,7 +74,7 @@ func getPIDsFromCgroupV1(pid string) ([]string, error) {
7474
if err != nil {
7575
return nil, err
7676
}
77-
defer f.Close()
77+
defer f.Close() //nolint:errcheck
7878

7979
scanner := bufio.NewScanner(f)
8080
cgroupPath := ""
@@ -109,7 +109,7 @@ func getPIDsFromCgroupV1(pid string) ([]string, error) {
109109
return nil, err
110110
}
111111
}
112-
defer f.Close()
112+
defer f.Close() //nolint:errcheck
113113

114114
pids := []string{}
115115
scanner = bufio.NewScanner(f)
@@ -128,7 +128,7 @@ func getPIDsFromCgroupV2(pid string) ([]string, error) {
128128
if err != nil {
129129
return nil, err
130130
}
131-
defer f.Close()
131+
defer f.Close() //nolint:errcheck
132132

133133
scanner := bufio.NewScanner(f)
134134
cgroupSlice := ""
@@ -152,7 +152,7 @@ func getPIDsFromCgroupV2(pid string) ([]string, error) {
152152
if err != nil {
153153
return nil, err
154154
}
155-
defer f.Close()
155+
defer f.Close() //nolint:errcheck
156156

157157
pids := []string{}
158158
scanner = bufio.NewScanner(f)

psgo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ func JoinNamespaceAndProcessInfoWithOptions(pid string, descriptors []string, op
425425
dataErr = err
426426
return
427427
}
428-
defer fd.Close()
428+
defer fd.Close() //nolint:errcheck
429429

430430
// create a new mountns on the current thread
431431
if err = unix.Unshare(unix.CLONE_NEWNS); err != nil {

sample/sample.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func main() {
6767

6868
tw := tabwriter.NewWriter(os.Stdout, 5, 1, 3, ' ', 0)
6969
for _, d := range data {
70-
fmt.Fprintln(tw, strings.Join(d, "\t"))
70+
_, _ = fmt.Fprintln(tw, strings.Join(d, "\t"))
7171
}
72-
tw.Flush()
72+
_ = tw.Flush()
7373
}

0 commit comments

Comments
 (0)