Skip to content
This repository was archived by the owner on Aug 31, 2025. It is now read-only.

Commit a3cde76

Browse files
authored
bump golangci-lint (#250)
1 parent 52d9473 commit a3cde76

File tree

25 files changed

+125
-113
lines changed

25 files changed

+125
-113
lines changed

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ jobs:
1717
with:
1818
go-version: "1.24"
1919

20-
- uses: golangci/golangci-lint-action@v3
20+
- uses: golangci/golangci-lint-action@v8
2121
with:
22-
version: v1.64.5
22+
version: v2.1.6
2323

2424
go-mod-tidy:
2525
runs-on: ubuntu-22.04

.golangci.yml

Lines changed: 51 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,75 @@
1+
version: "2"
2+
13
linters:
24
enable:
35
- asciicheck
46
- bidichk
57
- bodyclose
6-
#- contextcheck
78
- copyloopvar
89
- dupl
910
- errorlint
1011
- gochecknoinits
1112
- gocritic
12-
- gofmt
13-
- gofumpt
1413
- lll
1514
- misspell
1615
- nilerr
1716
- prealloc
1817
- predeclared
18+
- reassign
1919
- revive
2020
- usestdlibvars
2121
- unconvert
22-
#- usetesting
2322
- tparallel
2423
- wastedassign
2524
- whitespace
2625

27-
issues:
28-
exclude-use-default: false
26+
settings:
27+
errcheck:
28+
exclude-functions:
29+
- io.Copy
30+
- (io.Closer).Close
31+
- (io.Writer).Write
32+
- (hash.Hash).Write
33+
- (net.Conn).Close
34+
- (net.Conn).SetReadDeadline
35+
- (net.Conn).SetWriteDeadline
36+
- (*net.TCPConn).SetKeepAlive
37+
- (*net.TCPConn).SetKeepAlivePeriod
38+
- (*net.TCPConn).SetNoDelay
39+
- (net.Listener).Close
40+
- (net.PacketConn).Close
41+
- (net.PacketConn).SetReadDeadline
42+
- (net.PacketConn).SetWriteDeadline
43+
- (net/http.ResponseWriter).Write
44+
- (*net/http.Server).Serve
45+
- (*net/http.Server).ServeTLS
46+
- (*net/http.Server).Shutdown
47+
- os.Chdir
48+
- os.Mkdir
49+
- os.MkdirAll
50+
- os.Remove
51+
- os.RemoveAll
52+
- os.Setenv
53+
- os.Unsetenv
54+
- (*os.File).WriteString
55+
- (*os.File).Close
56+
- (github.com/datarhei/gosrt.Conn).Close
57+
- (github.com/datarhei/gosrt.Conn).SetReadDeadline
58+
- (github.com/datarhei/gosrt.Conn).SetWriteDeadline
59+
- (*github.com/bluenviron/gortsplib/v4.Client).Close
60+
- (*github.com/bluenviron/gortsplib/v4.Server).Close
61+
- (*github.com/bluenviron/gortsplib/v4.ServerSession).Close
62+
- (*github.com/bluenviron/gortsplib/v4.ServerStream).Close
63+
- (*github.com/bluenviron/gortsplib/v4.ServerConn).Close
2964

30-
linters-settings:
31-
errcheck:
32-
exclude-functions:
33-
- io.Copy
34-
- (io.Closer).Close
35-
- (io.Writer).Write
36-
- (hash.Hash).Write
37-
- (net.Conn).Close
38-
- (net.Conn).SetReadDeadline
39-
- (net.Conn).SetWriteDeadline
40-
- (*net.TCPConn).SetKeepAlive
41-
- (*net.TCPConn).SetKeepAlivePeriod
42-
- (*net.TCPConn).SetNoDelay
43-
- (net.Listener).Close
44-
- (net.PacketConn).Close
45-
- (net.PacketConn).SetReadDeadline
46-
- (net.PacketConn).SetWriteDeadline
47-
- (net/http.ResponseWriter).Write
48-
- (*net/http.Server).Serve
49-
- (*net/http.Server).ServeTLS
50-
- (*net/http.Server).Shutdown
51-
- os.Chdir
52-
- os.Mkdir
53-
- os.MkdirAll
54-
- os.Remove
55-
- os.RemoveAll
56-
- os.Setenv
57-
- os.Unsetenv
58-
- (*os.File).WriteString
59-
- (*os.File).Close
60-
- (github.com/datarhei/gosrt.Conn).Close
61-
- (github.com/datarhei/gosrt.Conn).SetReadDeadline
62-
- (github.com/datarhei/gosrt.Conn).SetWriteDeadline
63-
- (*github.com/bluenviron/gortsplib/v4.Client).Close
64-
- (*github.com/bluenviron/gortsplib/v4.Server).Close
65-
- (*github.com/bluenviron/gortsplib/v4.ServerSession).Close
66-
- (*github.com/bluenviron/gortsplib/v4.ServerStream).Close
67-
- (*github.com/bluenviron/gortsplib/v4.ServerConn).Close
65+
govet:
66+
enable-all: true
67+
disable:
68+
- fieldalignment
69+
- reflectvaluecompare
6870

69-
govet:
70-
enable-all: true
71-
disable:
72-
- fieldalignment
73-
- reflectvaluecompare
71+
formatters:
72+
enable:
73+
- gofmt
74+
- gofumpt
75+
- goimports

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
BASE_IMAGE = golang:1.24-alpine3.20
2-
LINT_IMAGE = golangci/golangci-lint:v1.64.5
2+
LINT_IMAGE = golangci/golangci-lint:v2.1.6
33

44
.PHONY: $(shell ls)
55

action_client.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -389,19 +389,19 @@ type ActionClient struct {
389389
// NewActionClient allocates an ActionClient. See ActionClientConf for the options.
390390
func NewActionClient(conf ActionClientConf) (*ActionClient, error) {
391391
if conf.Node == nil {
392-
return nil, fmt.Errorf("Node is empty")
392+
return nil, fmt.Errorf("'Node' is empty")
393393
}
394394

395395
if conf.Name == "" {
396-
return nil, fmt.Errorf("Name is empty")
396+
return nil, fmt.Errorf("'Name' is empty")
397397
}
398398

399399
if conf.Action == nil {
400-
return nil, fmt.Errorf("Action is empty")
400+
return nil, fmt.Errorf("'Action' is empty")
401401
}
402402

403403
if reflect.TypeOf(conf.Action).Kind() != reflect.Ptr {
404-
return nil, fmt.Errorf("Action is not a pointer")
404+
return nil, fmt.Errorf("'Action' is not a pointer")
405405
}
406406

407407
actionElem := reflect.ValueOf(conf.Action).Elem().Interface()
@@ -587,10 +587,10 @@ func (ac *ActionClient) WaitForServer() {
587587
// SendGoal sends a goal.
588588
func (ac *ActionClient) SendGoal(conf ActionClientGoalConf) (*ActionClientGoalHandler, error) {
589589
if conf.Goal == nil {
590-
return nil, fmt.Errorf("Goal is empty")
590+
return nil, fmt.Errorf("'Goal' is empty")
591591
}
592592
if reflect.TypeOf(conf.Goal) != reflect.PointerTo(ac.goalType) {
593-
return nil, fmt.Errorf("Goal must be %s, while is %v",
593+
return nil, fmt.Errorf("'Goal' must be %s, while is %v",
594594
reflect.PointerTo(ac.goalType), reflect.TypeOf(conf.Goal))
595595
}
596596

action_server.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,19 +248,19 @@ type ActionServer struct {
248248
// NewActionServer allocates an ActionServer. See ActionServerConf for the options.
249249
func NewActionServer(conf ActionServerConf) (*ActionServer, error) {
250250
if conf.Node == nil {
251-
return nil, fmt.Errorf("Node is empty")
251+
return nil, fmt.Errorf("'Node' is empty")
252252
}
253253

254254
if conf.Name == "" {
255-
return nil, fmt.Errorf("Name is empty")
255+
return nil, fmt.Errorf("'Name' is empty")
256256
}
257257

258258
if conf.Action == nil {
259-
return nil, fmt.Errorf("Action is empty")
259+
return nil, fmt.Errorf("'Action' is empty")
260260
}
261261

262262
if reflect.TypeOf(conf.Action).Kind() != reflect.Ptr {
263-
return nil, fmt.Errorf("Action is not a pointer")
263+
return nil, fmt.Errorf("'Action' is not a pointer")
264264
}
265265

266266
if conf.StatusPeriod == 0 {

examples/cluster-info/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package main contains an example.
12
package main
23

34
import (

examples/param-set-get/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package main contains an example.
12
package main
23

34
import (

examples/publisher-custom/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package main contains an example.
12
package main
23

34
import (
@@ -10,9 +11,8 @@ import (
1011
"github.com/bluenviron/goroslib/v2/pkg/msg"
1112
)
1213

13-
// define a custom message.
14+
// TestMessage is a custom message.
1415
// unlike the standard library, a .msg file is not needed.
15-
// a structure definition is enough.
1616
type TestMessage struct {
1717
msg.Package `ros:"my_package"`
1818
FirstField uint32

examples/publisher/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package main contains an example.
12
package main
23

34
import (

examples/serviceclient/main.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package main contains an example.
12
package main
23

34
import (
@@ -10,16 +11,16 @@ import (
1011
// define a custom service.
1112
// unlike the standard library, a .srv file is not needed.
1213

13-
type TestServiceReq struct {
14+
type TestServiceReq struct { //nolint:revive
1415
A float64
1516
B string
1617
}
1718

18-
type TestServiceRes struct {
19+
type TestServiceRes struct { //nolint:revive
1920
C float64
2021
}
2122

22-
type TestService struct {
23+
type TestService struct { //nolint:revive
2324
msg.Package `ros:"my_package"`
2425
TestServiceReq
2526
TestServiceRes

0 commit comments

Comments
 (0)