Skip to content

Commit cb7cf24

Browse files
authored
chore: bump Go baseline to 1.24 and update CI/test compatibility (#648)
* chore: bump Go baseline to 1.24 and update CI/test compatibility - Raise Go version requirements from 1.20 to 1.24 in CI workflows, lint config, and project docs. - Keep Windows CI capped below Go 1.26 as noted in workflow comments. - Expand TLS listener test error assertion to also accept the Windows-specific remote-close message. * chore(lint): add scoped golangci exclusions for legacy DTLS and style noise - exclude perfsprint findings in test files - suppress revive stutter warning for DTLS compatibility type names - suppress revive stdlib-package-name warnings for existing package layout - suppress staticcheck SA1019 warnings for intentional legacy DTLS config/dial usage * chore(ci): bump SonarQube scan action to v6 in test workflow
1 parent 35c7432 commit cb7cf24

File tree

6 files changed

+31
-17
lines changed

6 files changed

+31
-17
lines changed

.github/workflows/staticAnalysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313
- name: Checkout
1414
uses: actions/checkout@v5
1515

16-
- name: Set up Go 1.20+
16+
- name: Set up Go 1.24+
1717
uses: actions/setup-go@v6
1818
with:
19-
go-version: "^1.20" # The Go version to download (if necessary) and use.
19+
go-version: "^1.24" # The Go version to download (if necessary) and use.
2020
check-latest: true
2121

2222
- run: go version

.github/workflows/test-for-fork.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ jobs:
1414
os: [ubuntu-latest, windows-latest, macOS-latest]
1515

1616
steps:
17-
- name: Set up Go 1.20-1.25 (Windows)
17+
- name: Set up Go 1.24-1.25 (Windows)
1818
if: runner.os == 'Windows'
1919
uses: actions/setup-go@v6
2020
with:
21-
go-version: ">=1.20 <1.26" # Temporary cap: Go 1.26 has a CI bug on Windows.
21+
go-version: ">=1.24 <1.26" # Temporary cap: Go 1.26 has a CI bug on Windows.
2222
check-latest: true
2323

24-
- name: Set up Go 1.20+ (Non-Windows)
24+
- name: Set up Go 1.24+ (Non-Windows)
2525
if: runner.os != 'Windows'
2626
uses: actions/setup-go@v6
2727
with:
28-
go-version: "^1.20"
28+
go-version: "^1.24"
2929
check-latest: true
3030

3131
- run: go version

.github/workflows/test.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@ jobs:
2323
os: [ubuntu-latest, windows-latest, macOS-latest]
2424

2525
steps:
26-
- name: Set up Go 1.20-1.25 (Windows)
26+
- name: Set up Go 1.24-1.25 (Windows)
2727
if: runner.os == 'Windows'
2828
uses: actions/setup-go@v6
2929
with:
30-
go-version: ">=1.20 <1.26" # Temporary cap: Go 1.26 has a CI bug on Windows.
30+
go-version: ">=1.24 <1.26" # Temporary cap: Go 1.26 has a CI bug on Windows.
3131
check-latest: true
3232

33-
- name: Set up Go 1.20+ (Non-Windows)
33+
- name: Set up Go 1.24+ (Non-Windows)
3434
if: runner.os != 'Windows'
3535
uses: actions/setup-go@v6
3636
with:
37-
go-version: "^1.20"
37+
go-version: "^1.24"
3838
check-latest: true
3939

4040
- run: go version
@@ -104,7 +104,7 @@ jobs:
104104
directory: .tmp/
105105

106106
- name: SonarQube Scan
107-
uses: SonarSource/sonarqube-scan-action@v5
107+
uses: SonarSource/sonarqube-scan-action@v6
108108
env:
109109
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
110110
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
@@ -119,10 +119,10 @@ jobs:
119119
runs-on: ubuntu-latest
120120

121121
steps:
122-
- name: Set up Go 1.20
122+
- name: Set up Go 1.24
123123
uses: actions/setup-go@v6
124124
with:
125-
go-version: "~1.20"
125+
go-version: "~1.24"
126126

127127
- run: go version
128128

.golangci.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version: "2"
22
run:
3-
go: "1.20"
3+
go: "1.24"
44
# issues:
55
# fix: true
66
linters:
@@ -46,7 +46,7 @@ linters:
4646
- nestif # Reports deeply nested if statements
4747
- nilerr # Finds the code that returns nil even if it checks that the error is not nil.
4848
- nilnil # Checks that there is no simultaneous return of `nil` error and an invalid value.
49-
# - noctx # noctx finds sending http request without context.Context - Some occurrences are not support in go1.20
49+
# - noctx # noctx finds sending http request without context.Context - Some occurrences are not support in go1.24
5050
- nolintlint # Reports ill-formed or insufficient nolint directives
5151
- nosprintfhostport # Checks for misuse of Sprintf to construct a host with port in a URL
5252
- perfsprint # Checks that fmt.Sprintf can be replaced with a faster alternative.
@@ -124,6 +124,7 @@ linters:
124124
- gocyclo
125125
- gosec
126126
- nakedret
127+
- perfsprint
127128
path: _test\.go
128129
- linters:
129130
- dupl
@@ -143,6 +144,18 @@ linters:
143144
- godox
144145
path: .*.go
145146
text: replace with standard maps package
147+
- linters:
148+
- revive
149+
path: '^dtls/clientoptions\.go'
150+
text: 'stutters; consider calling this Client(Options|Config)'
151+
- linters:
152+
- revive
153+
path: '^(pkg/errors/error\.go|pkg/math/cast\.go|test/net/uri\.go|net/.*\.go)$'
154+
text: 'avoid package names that conflict with Go standard library package names'
155+
- linters:
156+
- staticcheck
157+
path: '^(dtls/client\.go|dtls/client_test\.go|dtls/clientoptions\.go|dtls/server_test\.go|dtls/example_test\.go|net/dtlslistener\.go|net/dtlsoptions\.go)$'
158+
text: 'SA1019: (piondtls\.(Config|Dial)|dtls\.Config) is deprecated'
146159
# Which file paths to exclude: they will be analyzed, but issues from them won't be reported.
147160
# "/" will be replaced by the current OS file path separator to properly work on Windows.
148161
# Default: []

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ The go-coap provides servers and clients for DTLS, TCP-TLS, UDP, TCP in golang l
3838

3939
## Requirements
4040

41-
* Go 1.20 or higher
41+
* Go 1.24 or higher
4242

4343
## Samples
4444

net/tlslistener_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,9 @@ func TestTLSListenerCheckForInfinitLoop(t *testing.T) {
227227
require.Error(t, err)
228228
// On macOS a RST during TLS handshake yields "connection reset by peer" instead of EOF;
229229
// both indicate the remote side closed the connection.
230+
// On Windows, the error message is "connection was forcibly closed by the remote host".
230231
assert.True(t,
231-
strings.Contains(err.Error(), "EOF") || strings.Contains(err.Error(), "connection reset by peer"),
232+
strings.Contains(err.Error(), "EOF") || strings.Contains(err.Error(), "connection reset by peer") || strings.Contains(err.Error(), "connection was forcibly closed by the remote host"),
232233
"expected EOF or connection reset by peer, got: %v", err,
233234
)
234235
err = con.Close()

0 commit comments

Comments
 (0)