Skip to content

Commit ba9cae2

Browse files
committed
BUILD/MAJOR: go: upgrade to go 1.23
Also upgrade linter, cleanup excluded linters, make linting changes and upgrade go-swagger to latest version
1 parent 35576d3 commit ba9cae2

File tree

331 files changed

+2199
-1261
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

331 files changed

+2199
-1261
lines changed

.gitlab-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
variables:
33
DOCKER_HOST: tcp://docker:2375
4-
GO_VERSION: "1.22"
5-
DOCKER_VERSION: "24.0.6"
4+
GO_VERSION: "1.23"
5+
DOCKER_VERSION: "26.0"
66
stages:
77
- check-commit
88
- generate

.golangci.yml

Lines changed: 18 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
22
linters-settings:
3-
govet:
4-
check-shadowing: true
53
golint:
64
min-confidence: 0
75
gocyclo:
@@ -21,59 +19,34 @@ linters-settings:
2119
linters:
2220
enable-all: true
2321
disable:
24-
- golint # deprecated, replaced with revive
25-
- interfacer # deprecated
26-
- maligned # deprecated
27-
- wrapcheck
28-
- nlreturn
29-
- gomnd
30-
- goerr113
31-
- exhaustivestruct
22+
- mnd
23+
- err113
3224
- wsl
33-
- whitespace
34-
- lll
35-
- scopelint
36-
- nestif
37-
- funlen
38-
- paralleltest
25+
- wrapcheck
3926
- godot
4027
- varnamelen
28+
- nlreturn
4129
- ireturn
42-
- ifshort
43-
- thelper
44-
- wastedassign
45-
- goconst
46-
- gci
47-
- exhaustruct
48-
- nonamedreturns
4930
- interfacebloat
31+
- gomnd
32+
- forcetypeassert
33+
- exhaustruct
5034
- dupword
51-
- forcetypeassert # tmp needs to be on
52-
- ifshort # deprecated
53-
- structcheck # deprecated
54-
- deadcode # deprecated
55-
- nosnakecase # deprecated
56-
- varcheck # deprecated
57-
- rowserrcheck # deprecated
58-
- sqlclosecheck # deprecated
59-
- wastedassign # deprecated
60-
- golint # deprecated
61-
- interfacer # deprecated
62-
- maligned # deprecated
35+
- nestif
36+
- lll
6337
- depguard
38+
- funlen
39+
- gci
40+
- goconst
41+
- execinquery
42+
- exportloopref
6443

6544
issues:
45+
exclude-files:
46+
- ".*_test\\.go$"
47+
exclude-dirs:
48+
- test
6649
exclude:
67-
# bugs of typecheck linter
68-
- "undeclared name: `shellquote`"
69-
- "github.com/kballard/go-shellquote\" imported but not used"
70-
- "github.com/haproxytech/client-native/v6/config-parser/types\" imported but not used"
7150
- "unused-parameter: parameter 'comment' seems to be unused"
7251
- "unused-parameter: parameter 'parts' seems to be unused"
7352
- "unused-parameter: parameter 'parserType' seems to be unused"
74-
75-
run:
76-
skip-dirs:
77-
- test
78-
skip-files:
79-
- ".*_test\\.go$"

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
PROJECT_PATH=${PWD}
2-
DOCKER_HAPROXY_VERSION?=2.8
3-
SWAGGER_VERSION=v0.30.2
2+
DOCKER_HAPROXY_VERSION?=3.0
3+
SWAGGER_VERSION=v0.31.0
44
GO_VERSION:=${shell go mod edit -json | jq -r .Go}
5-
GOLANGCI_LINT_VERSION=1.55.2
5+
GOLANGCI_LINT_VERSION=1.61.0
66

77
.PHONY: test
88
test:

cmd/kubebuilder_marker_generator/main.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func main() {
3232
}
3333
}
3434

35-
func generate(fileName string) error { //nolint:gocognit,unparam
35+
func generate(fileName string) error { //nolint:gocognit
3636
f, err := decorator.ParseFile(token.NewFileSet(), fileName, nil, 0)
3737
if err != nil {
3838
log.Fatal(err)
@@ -86,7 +86,6 @@ func generate(fileName string) error { //nolint:gocognit,unparam
8686
field.Decorations().Start.Append("// +kubebuilder:validation:Optional")
8787
}
8888
}
89-
9089
}
9190
// if len(field.Names) > 0 {
9291
// log.Printf("Comments before the field %s: %v\n", field.Names[0].Name, comments)

cmd/specification/build.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ func expandRef(refValue string, absPath string, prefix string) string {
8181
}
8282
retValStr := buf.String()
8383

84-
indentedRetValStr := ""
85-
indentedLine := ""
84+
var indentedRetValStr string
85+
var indentedLine string
8686
for _, line := range strings.Split(retValStr, "\n") {
8787
if strings.TrimSpace(line) != "" {
8888
indentedLine = prefix + "" + line + "\n"

cmd/struct_equal_generator/args.go

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

33
import (
44
_ "embed"
5+
"errors"
56
"fmt"
67
"io/fs"
78
"log"
@@ -29,7 +30,7 @@ func (a *Args) Parse() error { //nolint:gocognit
2930
switch {
3031
case val == "-l":
3132
if i+1 >= len(os.Args) {
32-
return fmt.Errorf("missing licence file after -l")
33+
return errors.New("missing licence file after -l")
3334
}
3435
a.LicencePath = os.Args[i+1]
3536
i++

cmd/struct_equal_generator/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,7 @@ func generate(fileName string, args Args) (string, error) { //nolint:gocognit,ma
162162
switch currType := currSpecType.Type.(type) {
163163
case *ast.StructType:
164164
var fields []Field
165-
needsOptions := false
166-
needsOptionsIndex := false
167-
fields, needsOptions, needsOptionsIndex = getFields(fields, currType, imports)
165+
fields, needsOptions, needsOptionsIndex := getFields(fields, currType, imports)
168166
for _, f := range fields {
169167
if strings.HasPrefix(f.Type, "*") && (f.HasEqualOpt || f.HasEqual) {
170168
needsOptions = true
@@ -271,7 +269,9 @@ func generate(fileName string, args Args) (string, error) { //nolint:gocognit,ma
271269
return packageName, nil
272270
}
273271

274-
func getFields(fields []Field, node *ast.StructType, imports map[string]string) (fieldsResult []Field, needsOptions, needsOptionsIndex bool) { //nolint:gocognit
272+
func getFields(fields []Field, node *ast.StructType, imports map[string]string) ([]Field, bool, bool) { //nolint:gocognit
273+
var needsOptions bool
274+
var needsOptionsIndex bool
275275
for _, field := range node.Fields.List {
276276
if len(field.Names) > 0 {
277277
res := getTypeString(field.Type, imports)

cmd/struct_tags_checker/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func main() {
2626
}
2727
}
2828

29-
func generate(fileName string) error { //nolint:gocognit,unparam
29+
func generate(fileName string) error { //nolint:gocognit
3030
f, err := decorator.ParseFile(token.NewFileSet(), fileName, nil, 0)
3131
if err != nil {
3232
log.Fatal(err)

config-parser/params/balance-params.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ func (b *BalanceURI) String() string {
4242
func (b *BalanceURI) Parse(parts []string) (BalanceParams, error) {
4343
var err error
4444
if len(parts) > 0 {
45-
4645
for i := 0; i < len(parts); i++ {
4746
arg := parts[i]
4847

@@ -98,7 +97,6 @@ func (u *BalanceURLParam) String() string {
9897
func (u *BalanceURLParam) Parse(parts []string) (BalanceParams, error) {
9998
var err error
10099
if len(parts) > 0 {
101-
102100
for index := 1; index < len(parts); index++ {
103101
arg := parts[index]
104102

config-parser/params/server-options.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ type ServerOptionIDValue struct {
127127
// Parse ...
128128
func (b *ServerOptionIDValue) Parse(options []string, currentIndex int) (int, error) {
129129
if currentIndex+1 < len(options) {
130-
if strings.HasPrefix(options[currentIndex], fmt.Sprintf("%s(", b.Name)) {
130+
if strings.HasPrefix(options[currentIndex], b.Name+"(") {
131131
words := strings.Split(options[currentIndex], "(")
132132
if len(words) != 2 {
133133
return 0, &NotEnoughParamsError{}

0 commit comments

Comments
 (0)