Skip to content

Commit 0b578f3

Browse files
authored
Merge pull request #77 from rollandf/go24
chore: update to go 1.24
2 parents 76c4a72 + 24a940b commit 0b578f3

File tree

7 files changed

+27
-33
lines changed

7 files changed

+27
-33
lines changed

.github/workflows/buildtest.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
name: build
1010
strategy:
1111
matrix:
12-
go-version: [1.20.x]
12+
go-version: [1.24.x]
1313
os: [ubuntu-22.04]
1414
goos: [linux]
1515
goarch: [amd64]
@@ -35,7 +35,7 @@ jobs:
3535
- name: set up Go
3636
uses: actions/setup-go@v3
3737
with:
38-
go-version: 1.20.x
38+
go-version: 1.24.x
3939
- name: check out code into the Go module directory
4040
uses: actions/checkout@v3
4141
- name: run unit-test
@@ -49,7 +49,7 @@ jobs:
4949
- name: Set up Go
5050
uses: actions/setup-go@v3
5151
with:
52-
go-version: 1.20.x
52+
go-version: 1.24.x
5353
- name: Check out code into the Go module directory
5454
uses: actions/checkout@v2
5555
- name: Go test with coverage

.github/workflows/static-scan.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
- name: set up Go
99
uses: actions/setup-go@v3
1010
with:
11-
go-version: 1.20.x
11+
go-version: 1.24.x
1212
- name: checkout PR
1313
uses: actions/checkout@v2
1414
- name: run make lint

.golangci.yml

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
linters-settings:
2+
revive:
3+
rules:
4+
- name: dot-imports
5+
arguments:
6+
- allowedPackages:
7+
- "github.com/onsi/ginkgo/v2"
8+
- "github.com/onsi/gomega"
29
dupl:
310
threshold: 150
411
funlen:
@@ -7,31 +14,14 @@ linters-settings:
714
goconst:
815
min-len: 2
916
min-occurrences: 2
10-
gocritic:
11-
enabled-tags:
12-
- diagnostic
13-
- experimental
14-
- opinionated
15-
- performance
16-
- style
17-
disabled-checks:
18-
- dupImport # https://github.com/go-critic/go-critic/issues/845
19-
- ifElseChain
20-
- octalLiteral
21-
- whyNoLint
22-
- wrapperFunc
23-
- unnamedResult
2417
gocognit:
2518
min-complexity: 30
2619
goimports:
2720
local-prefixes: github.com/k8snetworkplumbingwg/rdma-cni
28-
gomnd:
29-
settings:
30-
mnd:
31-
# don't include the "operation" and "assign"
32-
checks: [argument,case,condition,return]
21+
mnd:
22+
# don't include the "operation" and "assign"
23+
checks: [argument,case,condition,return]
3324
govet:
34-
check-shadowing: true
3525
settings:
3626
printf:
3727
funcs:
@@ -53,19 +43,17 @@ linters:
5343
disable-all: true
5444
enable:
5545
- bodyclose
56-
- depguard
5746
- dogsled
5847
- dupl
5948
- errcheck
60-
- exportloopref
6149
- funlen
6250
- gochecknoinits
6351
- goconst
6452
- gocritic
6553
- gocognit
6654
- gofmt
6755
- goimports
68-
- gomnd
56+
- mnd
6957
- goprintffuncname
7058
- gosec
7159
- gosimple
@@ -90,8 +78,8 @@ issues:
9078
exclude-rules:
9179
- path: _test\.go
9280
linters:
93-
- gomnd
81+
- mnd
9482
- goconst
9583
- text: "Magic number: 1"
9684
linters:
97-
- gomnd
85+
- mnd

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ GOLANGCI_LINT = $(BINDIR)/golangci-lint
5252
# golangci-lint version should be updated periodically
5353
# we keep it fixed to avoid it from unexpectedly failing on the project
5454
# in case of a version bump
55-
GOLANGCI_LINT_VER = v1.51.2
55+
GOLANGCI_LINT_VER = v1.64.7
5656
TIMEOUT = 30
5757
Q = $(if $(filter 1,$V),,@)
5858

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/k8snetworkplumbingwg/rdma-cni
22

3-
go 1.20
3+
go 1.24
44

55
require (
66
github.com/Mellanox/rdmamap v1.0.0

go.sum

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2
146146
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
147147
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
148148
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
149+
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
149150
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
150151
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
151152
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=

pkg/cache/cache.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ import (
77
"strings"
88
)
99

10+
const (
11+
dirPerms = 0o700
12+
filePerms = 0o600
13+
)
14+
1015
var (
1116
// CacheDir is used By default for caching CNI network state
1217
CacheDir = "/var/lib/cni/rdma"
@@ -47,14 +52,14 @@ func (sc *FsStateCache) Save(ref StateRef, state interface{}) error {
4752
}
4853

4954
//nolint:gomnd
50-
if err = sc.fsOps.MkdirAll(sc.basePath, 0700); err != nil {
55+
if err = sc.fsOps.MkdirAll(sc.basePath, dirPerms); err != nil {
5156
return fmt.Errorf("failed to create data cache directory(%q): %v", sc.basePath, err)
5257
}
5358

5459
path := filepath.Join(sc.basePath, sRef)
5560

5661
//nolint:gomnd
57-
err = sc.fsOps.WriteFile(path, bytes, 0600)
62+
err = sc.fsOps.WriteFile(path, bytes, filePerms)
5863
if err != nil {
5964
return fmt.Errorf("failed to write cache data in the path(%q): %v", path, err)
6065
}

0 commit comments

Comments
 (0)