Skip to content

Commit f2ae96b

Browse files
authored
Update Go (#137)
* Update minimum Go version to 1.24.0. * Update Go matrix to current releses. * Run Go `modernize` tool. * Update golangci-lint. * Fix linting issues. Signed-off-by: SuperQ <superq@gmail.com>
1 parent e0461fb commit f2ae96b

File tree

8 files changed

+10
-22
lines changed

8 files changed

+10
-22
lines changed

.github/workflows/static-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ jobs:
1818
strategy:
1919
matrix:
2020
go-version:
21-
- "1.23"
2221
- "1.24"
22+
- "1.25"
2323
runs-on: ubuntu-latest
2424

2525
steps:
@@ -36,4 +36,4 @@ jobs:
3636
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
3737
with:
3838
args: --verbose
39-
version: v2.2.1
39+
version: v2.6.0

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ jobs:
1414
fail-fast: false
1515
matrix:
1616
go-version:
17-
- "1.23"
1817
- "1.24"
18+
- "1.25"
1919
os: [ubuntu-latest, macos-latest]
2020
runs-on: ${{ matrix.os }}
2121

.golangci.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@ linters:
99
- common-false-positives
1010
- legacy
1111
- std-error-handling
12-
paths:
13-
- third_party$
14-
- builtin$
15-
- examples$
1612
formatters:
1713
exclusions:
1814
generated: lax
19-
paths:
20-
- third_party$
21-
- builtin$
22-
- examples$

client_linux.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//go:build linux
2-
// +build linux
32

43
package wifi
54

@@ -964,7 +963,7 @@ func decodeRSN(b []byte) (*RSNInfo, error) {
964963
}
965964

966965
ri.PairwiseCiphers = make([]RSNCipher, 0, pcCount) // Pre-allocate with known capacity
967-
for i := 0; i < pcCount; i++ {
966+
for range pcCount {
968967
sel := binary.BigEndian.Uint32(b[pos : pos+4])
969968
ri.PairwiseCiphers = append(ri.PairwiseCiphers, RSNCipher(sel))
970969
pos += 4
@@ -992,7 +991,7 @@ func decodeRSN(b []byte) (*RSNInfo, error) {
992991
}
993992

994993
ri.AKMs = make([]RSNAKM, 0, akmCount) // Pre-allocate with known capacity
995-
for i := 0; i < akmCount; i++ {
994+
for range akmCount {
996995
sel := binary.BigEndian.Uint32(b[pos : pos+4])
997996
ri.AKMs = append(ri.AKMs, RSNAKM(sel))
998997
pos += 4

client_linux_integration_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//go:build linux
2-
// +build linux
32

43
package wifi_test
54

@@ -46,7 +45,7 @@ func TestIntegrationLinuxConcurrent(t *testing.T) {
4645
wg.Add(workers)
4746
defer wg.Wait()
4847

49-
for i := 0; i < workers; i++ {
48+
for i := range workers {
5049
go func(differentI int) {
5150
defer wg.Done()
5251
execN(t, iterations, names, differentI)
@@ -58,7 +57,7 @@ func execN(t *testing.T, n int, expect []string, workerID int) {
5857
c := testClient(t)
5958

6059
names := make(map[string]int)
61-
for i := 0; i < n; i++ {
60+
for i := range n {
6261
ifis, err := c.Interfaces()
6362
if err != nil {
6463
panicf("[worker_id %d; iteration %d] failed to retrieve interfaces: %v", workerID, i, err)
@@ -112,7 +111,7 @@ func testClient(t *testing.T) *wifi.Client {
112111
return c
113112
}
114113

115-
func panicf(format string, a ...interface{}) {
114+
func panicf(format string, a ...any) {
116115
panic(fmt.Sprintf(format, a...))
117116
}
118117

client_linux_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//go:build linux
2-
// +build linux
32

43
package wifi
54

@@ -568,7 +567,7 @@ func bitrateAttr(bitrate int) uint32 {
568567
return uint32(bitrate / 100 / 1000)
569568
}
570569

571-
func mustMessages(t *testing.T, command uint8, want interface{}) genltest.Func {
570+
func mustMessages(t *testing.T, command uint8, want any) genltest.Func {
572571
var as []attributeser
573572

574573
switch xs := want.(type) {

client_others.go

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

43
package wifi
54

go.mod

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

3-
go 1.23.0
3+
go 1.24.0
44

55
require (
66
github.com/google/go-cmp v0.7.0

0 commit comments

Comments
 (0)