Skip to content

Commit 43a2ddf

Browse files
committed
BUILD/MAJOR: go: upgrade to 1.25
1 parent b63a2f7 commit 43a2ddf

Some content is hidden

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

52 files changed

+356
-365
lines changed

.gitlab-ci.yml

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
variables:
33
DOCKER_HOST: tcp://docker:2375
4-
GO_VERSION: "1.24"
4+
GO_VERSION: "1.25"
55
DOCKER_VERSION: "26.0"
66
stages:
77
- bots
@@ -197,26 +197,6 @@ test-equal:
197197
- docker image tag $CI_REGISTRY_GO/haproxy-alpine:$HAPROXY_VERSION haproxytech/haproxy-alpine:$HAPROXY_VERSION
198198
script:
199199
- DOCKER_HAPROXY_VERSION=$HAPROXY_VERSION make e2e-docker
200-
HAProxy-2.2:
201-
extends: .e2e
202-
variables:
203-
HAPROXY_VERSION: "2.2"
204-
HAProxy-2.4:
205-
extends: .e2e
206-
variables:
207-
HAPROXY_VERSION: "2.4"
208-
HAProxy-2.6:
209-
extends: .e2e
210-
variables:
211-
HAPROXY_VERSION: "2.6"
212-
HAProxy-2.8:
213-
extends: .e2e
214-
variables:
215-
HAPROXY_VERSION: "2.8"
216-
HAProxy-2.9:
217-
extends: .e2e
218-
variables:
219-
HAPROXY_VERSION: "2.9"
220200
HAProxy-3.0:
221201
extends: .e2e
222202
variables:

.golangci.yml

Lines changed: 59 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,66 @@
1-
---
2-
linters-settings:
3-
golint:
4-
min-confidence: 0
5-
gocyclo:
6-
min-complexity: 42
7-
cyclop:
8-
max-complexity: 42
9-
maligned:
10-
suggest-new: true
11-
dupl:
12-
threshold: 200
13-
goconst:
14-
min-len: 2
15-
min-occurrences: 3
16-
gci:
17-
prefix: github.com/haproxytech/client-native/v6
18-
1+
version: "2"
192
linters:
20-
enable-all: true
3+
settings:
4+
cyclop:
5+
max-complexity: 42
6+
gocyclo:
7+
min-complexity: 42
8+
default: all
219
disable:
22-
- mnd
10+
- depguard
11+
- dupword
12+
- dupl
2313
- err113
24-
- wsl
25-
- wrapcheck
26-
- godot
27-
- varnamelen
28-
- nlreturn
29-
- ireturn
30-
- interfacebloat
31-
- forcetypeassert
3214
- exhaustruct
33-
- dupword
34-
- nestif
35-
- lll
36-
- depguard
15+
- forcetypeassert
16+
- funcorder
3717
- funlen
38-
- gci
3918
- goconst
19+
- godoclint
20+
- godot
21+
- interfacebloat
22+
- ireturn
23+
- lll
24+
- mnd
25+
- nestif
26+
- nlreturn
27+
- noinlineerr
4028
- recvcheck
41-
- tenv #deprecated
42-
43-
issues:
44-
exclude-files:
45-
- ".*_test\\.go$"
46-
exclude-dirs:
47-
- test
48-
exclude:
49-
- "unused-parameter: parameter 'comment' seems to be unused"
50-
- "unused-parameter: parameter 'parts' seems to be unused"
51-
- "unused-parameter: parameter 'parserType' seems to be unused"
29+
- revive
30+
- varnamelen
31+
- wrapcheck
32+
- wsl
33+
- wsl_v5
34+
exclusions:
35+
generated: lax
36+
presets:
37+
- comments
38+
- common-false-positives
39+
- legacy
40+
- std-error-handling
41+
rules:
42+
- path: (.+)\.go$
43+
text: 'unused-parameter: parameter ''comment'' seems to be unused'
44+
- path: (.+)\.go$
45+
text: 'unused-parameter: parameter ''parts'' seems to be unused'
46+
- path: (.+)\.go$
47+
text: 'unused-parameter: parameter ''parserType'' seems to be unused'
48+
paths:
49+
- .*_test\.go$
50+
- test
51+
- third_party$
52+
- builtin$
53+
- examples$
54+
formatters:
55+
enable:
56+
- gofmt
57+
- gofumpt
58+
- goimports
59+
exclusions:
60+
generated: lax
61+
paths:
62+
- .*_test\.go$
63+
- test
64+
- third_party$
65+
- builtin$
66+
- examples$

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ PROJECT_PATH=${PWD}
22
DOCKER_HAPROXY_VERSION?=3.0
33
SWAGGER_VERSION=v0.32.3
44
GO_VERSION:=${shell go mod edit -json | jq -r .Go}
5-
GOLANGCI_LINT_VERSION=1.64.5
5+
GOLANGCI_LINT_VERSION=2.8.0
6+
CHECK_COMMIT=5.2.0
67

78
.PHONY: test
89
test:

cmd/kubebuilder_marker_generator/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ func generate(fileName string) error { //nolint:gocognit
5858
// We must keep empty strings:
5959
// For example in Globals HttpclientSslVerify: // Enum: [ none required]
6060
// from swagger: enum: ["", "none", "required"]
61-
for _, enum := range strings.Split(comment, ",") {
61+
for enum := range strings.SplitSeq(comment, ",") {
6262
enum = strings.Trim(enum, "\"")
6363
if enum == "" {
6464
newComment += `""`
6565
}
66-
newComment += enum
66+
newComment += enum //nolint: perfsprint
6767
newComment += ";"
6868
}
6969
field.Decorations().Start.Append(newComment)

cmd/server_params_runtime/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func main() {
6464
doNotSendDisabledFields := listEmptyDisabledFields(allEnumFields)
6565
doNotSendEnabledFields := listEmtpyEnabledFields(allEnumFields)
6666

67-
errTmpl = tmpl.Execute(file, map[string]interface{}{
67+
errTmpl = tmpl.Execute(file, map[string]any{
6868
"PrepareFieldsForRuntimeAddServer": FuncPrepareFieldsForRuntimeAddServer,
6969
"DoNotSendDisabledFields": doNotSendDisabledFields,
7070
"DoNotSendDisabledFieldsFunc": FuncDoNotSendDisabledFields,

cmd/specification/build.go

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"gopkg.in/yaml.v3"
1818
)
1919

20-
var cache map[string]interface{} //nolint:gochecknoglobals
20+
var cache map[string]any //nolint:gochecknoglobals
2121

2222
func errorExit(msg string) {
2323
fmt.Fprintf(os.Stderr, "ERROR: %v\n", msg)
@@ -39,7 +39,7 @@ func expandRef(refValue string, absPath string, prefix string) string {
3939
filePath := path.Join(absPath, words[0])
4040
keyPath := words[1]
4141

42-
m, ok := cache[filePath].(map[string]interface{})
42+
m, ok := cache[filePath].(map[string]any)
4343
if !ok {
4444
fileHandle, err := os.Open(filePath)
4545
if err != nil {
@@ -48,11 +48,12 @@ func expandRef(refValue string, absPath string, prefix string) string {
4848
defer fileHandle.Close()
4949

5050
fileScanner := bufio.NewScanner(fileHandle)
51-
value := ""
51+
sb := strings.Builder{}
5252
for fileScanner.Scan() {
53-
value += fileScanner.Text() + "\n"
53+
sb.WriteString(fileScanner.Text())
54+
sb.WriteString("\n")
5455
}
55-
56+
value := sb.String()
5657
err = yaml.Unmarshal([]byte(value), &m)
5758
if err != nil {
5859
fmt.Println(refValue) //nolint:forbidigo
@@ -61,9 +62,9 @@ func expandRef(refValue string, absPath string, prefix string) string {
6162
}
6263
cache[filePath] = m
6364
}
64-
retVal := make(map[string]interface{})
65+
retVal := make(map[string]any)
6566
if m[keyPath[1:]] != nil {
66-
retVal = m[keyPath[1:]].(map[string]interface{})
67+
retVal = m[keyPath[1:]].(map[string]any)
6768
} else {
6869
fmt.Println(refValue) //nolint:forbidigo
6970
fmt.Println(keyPath) //nolint:forbidigo
@@ -83,17 +84,18 @@ func expandRef(refValue string, absPath string, prefix string) string {
8384

8485
var indentedRetValStr string
8586
var indentedLine string
86-
for _, line := range strings.Split(retValStr, "\n") {
87+
for line := range strings.SplitSeq(retValStr, "\n") {
8788
if strings.TrimSpace(line) != "" {
8889
indentedLine = prefix + "" + line + "\n"
89-
indentedRetValStr += indentedLine
90+
indentedRetValStr += indentedLine //nolint: perfsprint
9091
}
9192
}
9293

9394
return indentedRetValStr[:len(indentedRetValStr)-1]
9495
}
9596

96-
func main() { //nolint:gocognit
97+
//nolint:gocognit,modernize,perfsprint
98+
func main() {
9799
inputFilePtr := flag.String("file", "", "Source file")
98100

99101
flag.Parse()
@@ -106,7 +108,7 @@ func main() { //nolint:gocognit
106108
errorExit("File " + *inputFilePtr + " does not exist")
107109
}
108110

109-
cache = make(map[string]interface{})
111+
cache = make(map[string]any)
110112

111113
absPath := filepath.Dir(*inputFilePtr)
112114
fileHandle, err := os.Open(*inputFilePtr)
@@ -166,7 +168,7 @@ func main() { //nolint:gocognit
166168

167169
b, _ := yaml.Marshal(&ts)
168170

169-
for _, line := range strings.Split(strings.TrimRight(string(b), "\n"), "\n") {
171+
for line := range strings.SplitSeq(strings.TrimRight(string(b), "\n"), "\n") {
170172
result.WriteString(" " + line + "\n")
171173
}
172174
result.WriteString("security:")

cmd/struct_equal_generator/generate.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func generateEqualAndDiff(opt generateEqualAndDiffOptions) error {
1919
return err
2020
}
2121

22-
data := map[string]interface{}{
22+
data := map[string]any{
2323
"Mode": opt.Mode,
2424
"Name": opt.Name,
2525
"Type": opt.Type,
@@ -32,13 +32,13 @@ func generateEqualAndDiff(opt generateEqualAndDiffOptions) error {
3232
"IsPointer": opt.IsPointer,
3333
}
3434

35-
functions := map[string]interface{}{
36-
"Functions": []interface{}{
37-
map[string]interface{}{
35+
functions := map[string]any{
36+
"Functions": []any{
37+
map[string]any{
3838
"Name": "Equal",
3939
"Data": data,
4040
},
41-
map[string]interface{}{
41+
map[string]any{
4242
"Name": "Diff",
4343
"Data": data,
4444
},
@@ -82,7 +82,7 @@ func generateCompareTests(opt generateEqualAndDiffOptions) error {
8282
break
8383
}
8484
}
85-
err = tmpl.Execute(opt.FileTest, map[string]interface{}{
85+
err = tmpl.Execute(opt.FileTest, map[string]any{
8686
"TestType": []string{"Equal", "Diff"},
8787
"Name": opt.Name,
8888
"HasIndex": hasIndex,

cmd/struct_equal_generator/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func generate(fileName string, args Args) (string, error) { //nolint:gocognit,ma
110110
return packageName, err
111111
}
112112

113-
err = tmpl.Execute(file, map[string]interface{}{
113+
err = tmpl.Execute(file, map[string]any{
114114
"Package": node.Name.String(),
115115
"License": args.License,
116116
})
@@ -125,7 +125,7 @@ func generate(fileName string, args Args) (string, error) { //nolint:gocognit,ma
125125
return packageName, err
126126
}
127127

128-
err = tmpl2.Execute(fileTest, map[string]interface{}{
128+
err = tmpl2.Execute(fileTest, map[string]any{
129129
"Package": node.Name.String(),
130130
"License": args.License,
131131
})

cmd/struct_equal_generator/misc.go

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,27 +60,25 @@ func toJSON(x any) string {
6060

6161
func toCamelCase(s string) string {
6262
caser := cases.Title(language.Und)
63-
var result string
64-
words := strings.Split(s, "_")
65-
66-
for _, word := range words {
67-
result += caser.String(word)
63+
words := strings.SplitSeq(s, "_")
64+
sb := strings.Builder{}
65+
for word := range words {
66+
sb.WriteString(caser.String(word))
6867
}
69-
68+
result := sb.String()
7069
result = strings.ToLower(result[:1]) + result[1:]
7170

7271
return result
7372
}
7473

7574
func toLowerCase(s string) string {
7675
caser := cases.Lower(language.Und)
77-
var result string
78-
words := strings.Split(s, "_")
79-
80-
for _, word := range words {
81-
result += caser.String(word)
76+
words := strings.SplitSeq(s, "_")
77+
sb := strings.Builder{}
78+
for word := range words {
79+
sb.WriteString(caser.String(word))
8280
}
83-
81+
result := sb.String()
8482
result = strings.ToLower(result[:1]) + result[1:]
8583

8684
return result

cmd/struct_equal_generator/utils.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func createUtilsFile(packageName string, args Args) error {
2626
return err
2727
}
2828

29-
err = tmpl.Execute(file, map[string]interface{}{
29+
err = tmpl.Execute(file, map[string]any{
3030
"Package": packageName,
3131
"License": args.License,
3232
})
@@ -39,7 +39,7 @@ func createUtilsFile(packageName string, args Args) error {
3939
if err != nil {
4040
return err
4141
}
42-
err = tmpl.Execute(file, map[string]interface{}{})
42+
err = tmpl.Execute(file, map[string]any{})
4343
if err != nil {
4444
return err
4545
}

0 commit comments

Comments
 (0)