Skip to content

Commit 0168ce1

Browse files
committed
BUILD/MAJOR: go: upgrade to 1.25
1 parent c4f030b commit 0168ce1

66 files changed

Lines changed: 383 additions & 396 deletions

Some content is hidden

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

.gitlab-ci.yml

Lines changed: 3 additions & 31 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
@@ -216,35 +216,7 @@ test-equal:
216216
- docker image tag $CI_REGISTRY_GO/haproxy-alpine:$HAPROXY_VERSION haproxytech/haproxy-alpine:$HAPROXY_VERSION
217217
script:
218218
- DOCKER_HAPROXY_VERSION=$HAPROXY_VERSION make e2e-docker
219-
HAProxy-2.2:
219+
HAProxy-3.3:
220220
extends: .e2e
221221
variables:
222-
HAPROXY_VERSION: "2.2"
223-
HAProxy-2.4:
224-
extends: .e2e
225-
variables:
226-
HAPROXY_VERSION: "2.4"
227-
HAProxy-2.6:
228-
extends: .e2e
229-
variables:
230-
HAPROXY_VERSION: "2.6"
231-
HAProxy-2.8:
232-
extends: .e2e
233-
variables:
234-
HAPROXY_VERSION: "2.8"
235-
HAProxy-2.9:
236-
extends: .e2e
237-
variables:
238-
HAPROXY_VERSION: "2.9"
239-
HAProxy-3.0:
240-
extends: .e2e
241-
variables:
242-
HAPROXY_VERSION: "3.0"
243-
HAProxy-3.1:
244-
extends: .e2e
245-
variables:
246-
HAPROXY_VERSION: "3.1"
247-
HAProxy-3.2:
248-
extends: .e2e
249-
variables:
250-
HAPROXY_VERSION: "3.2"
222+
HAPROXY_VERSION: "3.3"

.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 & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
PROJECT_PATH=${PWD}
2-
DOCKER_HAPROXY_VERSION?=3.2
2+
DOCKER_HAPROXY_VERSION?=3.3
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
66
CHECK_COMMIT=5.2.0
77

88
.PHONY: test

cmd/defaults-setter/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ type Definition struct {
2828

2929
// Property represents a property of a model in the OpenAPI specification
3030
type Property struct {
31-
Default interface{} `yaml:"default"`
32-
Type string `yaml:"type"`
33-
GoType string `yaml:"x-go-name"` //nolint:tagliatelle
31+
Default any `yaml:"default"`
32+
Type string `yaml:"type"`
33+
GoType string `yaml:"x-go-name"` //nolint:tagliatelle
3434
}
3535

3636
type FieldInfo struct {
@@ -288,7 +288,7 @@ func insertCode(filepath, structName string, assignments []string, hasPointers b
288288
}
289289
}
290290

291-
var newAssignments []string
291+
var newAssignments []string //nolint: prealloc
292292
newAssignments = append(newAssignments, assignments...)
293293
newAssignments = append(newAssignments, "")
294294

cmd/gitlab-mr-checker/main.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,9 @@ type MergeRequest struct {
9090

9191
var baseURL string //nolint:gochecknoglobals
9292

93-
const LABEL_COLOR = "#8fbc8f" //nolint:stylecheck,revive
93+
const LABEL_COLOR = "#8fbc8f" //nolint:revive
9494

95+
//nolint:modernize,perfsprint
9596
func main() {
9697
_ = godotenv.Overload()
9798
fmt.Print(hello) //nolint:forbidigo
@@ -125,7 +126,7 @@ func main() {
125126
slog.Error(err.Error())
126127
os.Exit(1)
127128
}
128-
var versions []*semver.Version //nolint:prealloc
129+
var versions []*semver.Version
129130
for _, r := range docs {
130131
v, err := semver.NewVersion(r)
131132
if err != nil {
@@ -142,18 +143,18 @@ func main() {
142143

143144
gitlabToken := os.Getenv("GITLAB_TOKEN")
144145

145-
CI_MERGE_REQUEST_IID_STR := os.Getenv("CI_MERGE_REQUEST_IID") //nolint:stylecheck,revive
146+
CI_MERGE_REQUEST_IID_STR := os.Getenv("CI_MERGE_REQUEST_IID") //nolint:revive
146147
if CI_MERGE_REQUEST_IID_STR == "" {
147148
slog.Error("CI_MERGE_REQUEST_IID not set")
148149
os.Exit(1)
149150
}
150-
CI_MERGE_REQUEST_IID, err := strconv.Atoi(CI_MERGE_REQUEST_IID_STR) //nolint:stylecheck,revive
151+
CI_MERGE_REQUEST_IID, err := strconv.Atoi(CI_MERGE_REQUEST_IID_STR) //nolint:revive
151152
if err != nil {
152153
slog.Error(err.Error())
153154
os.Exit(1)
154155
}
155156

156-
CI_PROJECT_ID := os.Getenv("CI_PROJECT_ID") //nolint:stylecheck,revive
157+
CI_PROJECT_ID := os.Getenv("CI_PROJECT_ID") //nolint:revive
157158
if CI_PROJECT_ID == "" {
158159
slog.Error("CI_PROJECT_ID not set")
159160
os.Exit(1)
@@ -204,7 +205,7 @@ func main() {
204205

205206
func startThreadOnMergeRequest(baseURL, token, projectID string, mergeRequestIID int, threadBody string) {
206207
client := &http.Client{}
207-
threadData := map[string]interface{}{
208+
threadData := map[string]any{
208209
"body": threadBody,
209210
}
210211
threadDataBytes, err := json.Marshal(threadData)

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func generateCompareTests(opt generateEqualAndDiffOptions) error {
3939
break
4040
}
4141
}
42-
err = tmpl.Execute(opt.FileTest, map[string]interface{}{
42+
err = tmpl.Execute(opt.FileTest, map[string]any{
4343
"TestType": []string{"Equal", "Diff"},
4444
"Name": opt.Name,
4545
"HasIndex": hasIndex,

cmd/struct_equal_generator/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func generate(fileName string, args Args) (string, error) { //nolint:gocognit
101101
return packageName, err
102102
}
103103

104-
err = tmpl2.Execute(fileTest, map[string]interface{}{
104+
err = tmpl2.Execute(fileTest, map[string]any{
105105
"Package": node.Name.String(),
106106
"License": args.License,
107107
})

0 commit comments

Comments
 (0)