Skip to content

Commit 9f08246

Browse files
committed
BUILD/MEDIUM: update linter to 1.59.1 version
1 parent 3d72f8f commit 9f08246

File tree

28 files changed

+56
-58
lines changed

28 files changed

+56
-58
lines changed

.golangci.yml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
linters-settings:
22
govet:
3-
check-shadowing: true
3+
shadow: true
44
gocyclo:
55
min-complexity: 42
66
cyclop:
77
max-complexity: 42
8-
maligned:
9-
suggest-new: true
108
dupl:
119
threshold: 200
1210
revive:
@@ -20,15 +18,13 @@ linters:
2018
- ireturn
2119
- dupl
2220
- exhaustive
23-
- exhaustivestruct
2421
- funlen
2522
- gci
2623
- gochecknoglobals
2724
- gocognit
2825
- goconst
2926
- gocyclo
3027
- godot
31-
- goerr113
3228
- gomnd
3329
- lll
3430
- nestif
@@ -39,19 +35,14 @@ linters:
3935
- paralleltest
4036
- testpackage
4137
- varnamelen
42-
- nosnakecase
4338
- exhaustruct
4439
- nonamedreturns
4540
- forcetypeassert
46-
- golint #deprecated
47-
- varcheck #deprecated
48-
- ifshort #deprecated
49-
- structcheck #deprecated
50-
- maligned #deprecated
51-
- scopelint #deprecated
52-
- interfacer #deprecated
53-
- deadcode #deprecated
41+
- execinquery #deprecated
5442
- depguard
43+
- mnd
44+
- inamedparam
45+
- err113 # maybe tmp disable
5546
issues:
5647
exclude:
5748
- "tag is not aligned, should be:" # this is harder to read

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ PROJECT_PATH=${PWD}
22
TARGETPLATFORM?=linux/amd64
33
GOOS?=linux
44
GOARCH?=amd64
5-
GOLANGCI_LINT_VERSION=1.54.2
5+
GOLANGCI_LINT_VERSION=1.59.1
66

77
.PHONY: test
88
test:

deploy/tests/e2e/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ func (t *Test) GetK8sVersion() (major, minor int, err error) {
131131
if err != nil {
132132
return 0, 0, err
133133
}
134-
config, err := clientcmd.BuildConfigFromFlags("", fmt.Sprintf("%s/.kube/config", home))
134+
config, err := clientcmd.BuildConfigFromFlags("", home+"/.kube/config")
135135
if err != nil {
136136
return 0, 0, err
137137
}

deploy/tests/integration/customresources/customresource_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ func (suite *CustomResourceSuite) TestGlobalCR() {
4545
suite.globalCREvt.EventProcessed = eventProcessedChan
4646
testController.EventChan <- suite.globalCREvt
4747
<-eventProcessedChan
48-
assert.Len(t, globals, 0, "No Global CR should be present")
49-
assert.Len(t, logtrargets, 0, "No LogTargets should be present")
48+
assert.Empty(t, globals, "No Global CR should be present")
49+
assert.Empty(t, logtrargets, "No LogTargets should be present")
5050
})
5151

5252
suite.StopController()

pkg/annotations/service/checkHTTP.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package service
22

33
import (
4-
"fmt"
4+
"errors"
55
"strings"
66

77
"github.com/haproxytech/client-native/v5/models"
@@ -34,7 +34,7 @@ func (a *CheckHTTP) Process(k store.K8s, annotations ...map[string]string) error
3434
checkHTTPParams := strings.Fields(strings.TrimSpace(input))
3535
switch len(checkHTTPParams) {
3636
case 0:
37-
return fmt.Errorf("httpchk option: incorrect number of params")
37+
return errors.New("httpchk option: incorrect number of params")
3838
case 1:
3939
params = &models.HttpchkParams{
4040
URI: checkHTTPParams[0],

pkg/annotations/service/loadbalance.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package service
22

33
import (
4+
"errors"
45
"fmt"
56
"regexp"
67
"strconv"
@@ -49,7 +50,7 @@ func getParamsFromInput(value string) (*models.Balance, error) {
4950
balance := &models.Balance{}
5051
tokens := strings.Split(value, " ")
5152
if len(tokens) == 0 {
52-
return nil, fmt.Errorf("missing algorithm name")
53+
return nil, errors.New("missing algorithm name")
5354
}
5455

5556
reg := regexp.MustCompile(`(\(|\))`)

pkg/gateways/updates.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ func (statusMgr *StatusManagerImpl) UpdateStatusTCPRoutes(routesStatusRecords []
175175
}
176176

177177
for _, parentStatusRecord := range tcprouteStatusRecord.parentsStatusesRecords {
178-
parentStatusRecord := parentStatusRecord
179178
conditions := []metav1.Condition{}
180179
routeParentStatus := v1alpha2.RouteParentStatus{
181180
ControllerName: v1alpha2.GatewayController(statusMgr.gatewayControllerName),

pkg/handler/https.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ func (handler HTTPS) enableSSLPassthrough(h haproxy.HAProxy) (err error) {
232232
}),
233233
h.BackendSwitchingRuleCreate(h.FrontSSL, models.BackendSwitchingRule{
234234
Index: utils.PtrInt64(0),
235-
Name: fmt.Sprintf("%%[var(txn.sni_match),field(1,.)]"),
235+
Name: "%[var(txn.sni_match),field(1,.)]",
236236
}),
237237
handler.toggleSSLPassthrough(true, h))
238238
return errors.Result()

pkg/handler/tcp-services.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func (handler TCPServices) Update(k store.K8s, h haproxy.HAProxy, a annotations.
4040
if port == "log-format-tcp" {
4141
continue
4242
}
43-
frontendName := fmt.Sprintf("tcp-%s", port)
43+
frontendName := "tcp-" + port
4444
p, err = handler.parseTCPService(k, tcpSvcAnn)
4545
if err != nil {
4646
logger.Error(err)

pkg/haproxy/api/backend.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package api
22

33
import (
4-
"fmt"
4+
"errors"
55

66
"github.com/haproxytech/client-native/v5/models"
77
"github.com/haproxytech/config-parser/v5/types"
@@ -197,7 +197,7 @@ func (c *clientNative) BackendSwitchingRuleDeleteAll(frontend string) (err error
197197
if err != nil {
198198
return
199199
}
200-
for i := 0; i < len(switchingRules); i++ {
200+
for range len(switchingRules) {
201201
if err = configuration.DeleteBackendSwitchingRule(0, frontend, c.activeTransaction, 0); err != nil {
202202
break
203203
}
@@ -232,7 +232,7 @@ func (c *clientNative) BackendServersGet(backendName string) (models.Servers, er
232232
func (c *clientNative) RefreshBackends() (deleted []string, err error) {
233233
backends, errAPI := c.BackendsGet()
234234
if errAPI != nil {
235-
err = fmt.Errorf("unable to get configured backends")
235+
err = errors.New("unable to get configured backends")
236236
return
237237
}
238238
for _, backend := range backends {

0 commit comments

Comments
 (0)