Skip to content

Commit a9fdbb4

Browse files
authored
Merge pull request #1231 from jcmoraisjr/dependabot/github_actions/golangci/golangci-lint-action-7
Bump golangci/golangci-lint-action from 6 to 7
2 parents c90daf2 + f1f8c10 commit a9fdbb4

File tree

9 files changed

+46
-32
lines changed

9 files changed

+46
-32
lines changed

.github/workflows/build.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Run build
1919
run: make build
2020
- name: golangci-lint
21-
uses: golangci/golangci-lint-action@v6
21+
uses: golangci/golangci-lint-action@v7
2222
with:
2323
version: latest
2424
args: --verbose

.golangci.yml

+28-14
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,32 @@
1-
run:
2-
timeout: 5m
3-
issues:
4-
exclude-dirs:
5-
- pkg/acme/x
6-
- pkg/common
7-
- pkg/controller/legacy
1+
version: "2"
82
linters:
93
enable:
10-
- gofmt
11-
- goimports
12-
- gosimple
13-
- govet
14-
- ineffassign
154
- misspell
16-
- staticcheck
17-
- typecheck
185
- unconvert
6+
exclusions:
7+
generated: lax
8+
presets:
9+
- comments
10+
- common-false-positives
11+
- legacy
12+
- std-error-handling
13+
paths:
14+
- pkg/acme/x
15+
- pkg/common
16+
- pkg/controller/legacy
17+
- third_party$
18+
- builtin$
19+
- examples$
20+
formatters:
21+
enable:
22+
- gofmt
23+
- goimports
24+
exclusions:
25+
generated: lax
26+
paths:
27+
- pkg/acme/x
28+
- pkg/common
29+
- pkg/controller/legacy
30+
- third_party$
31+
- builtin$
32+
- examples$

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ test: gotestsum
4949

5050
.PHONY: golangci-lint
5151
golangci-lint:
52-
test -x $(LOCAL_GOLANGCI_LINT) || GOBIN=$(LOCALBIN) go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
52+
test -x $(LOCAL_GOLANGCI_LINT) || GOBIN=$(LOCALBIN) go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
5353

5454
.PHONY: lint
5555
lint: golangci-lint

pkg/controller/config/config.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ func CreateWithConfig(ctx context.Context, restConfig *rest.Config, opt *Options
307307
configLog.Info("running embedded haproxy", "mode", "daemon")
308308
}
309309

310-
if !(opt.ReloadStrategy == "native" || opt.ReloadStrategy == "reusesocket" || opt.ReloadStrategy == "multibinder") {
310+
if opt.ReloadStrategy != "native" && opt.ReloadStrategy != "reusesocket" && opt.ReloadStrategy != "multibinder" {
311311
return nil, fmt.Errorf("unsupported reload strategy: %s", opt.ReloadStrategy)
312312
}
313313
if opt.ReloadStrategy == "multibinder" {

pkg/controller/services/svchealthz.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func (s *svcHealthz) createStopHandler() http.HandlerFunc {
136136
err := syscall.Kill(syscall.Getpid(), syscall.SIGTERM)
137137
if err != nil {
138138
w.WriteHeader(http.StatusInternalServerError)
139-
_, _ = w.Write([]byte(fmt.Sprintf("failed to stop process: %s\n", err)))
139+
_, _ = fmt.Fprintf(w, "failed to stop process: %s\n", err)
140140
} else {
141141
_, _ = w.Write([]byte("controller process is stopping now\n"))
142142
}

pkg/haproxy/instance_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -5682,7 +5682,7 @@ func (c *testConfig) checkConfig(expected string) {
56825682
}
56835683

56845684
func (c *testConfig) checkConfigFile(expected, fileName string) {
5685-
actual := strings.Replace(c.readConfig(filepath.Join(c.tempdir, fileName)), c.tempdir, "/etc/haproxy/maps", -1)
5685+
actual := strings.ReplaceAll(c.readConfig(filepath.Join(c.tempdir, fileName)), c.tempdir, "/etc/haproxy/maps")
56865686
replace := map[string]string{
56875687
"<<global>>": `global
56885688
daemon
@@ -5806,7 +5806,7 @@ frontend healthz
58065806
for {
58075807
changed := false
58085808
for old, new := range replace {
5809-
after := strings.Replace(expected, old, new, -1)
5809+
after := strings.ReplaceAll(expected, old, new)
58105810
if after != expected {
58115811
changed = true
58125812
}

pkg/utils/utils.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@ func SizeSuffixToInt64(size string) (int64, error) {
9292
return value, nil
9393
}
9494
if len(size) == 0 {
95-
return 0, fmt.Errorf("Cannot convert empty string to int64")
95+
return 0, fmt.Errorf("cannot convert empty string to int64")
9696
}
9797
valueStr := size[:len(size)-1]
9898
value, err = strconv.ParseInt(valueStr, 10, 64)
9999
if err != nil {
100-
return 0, fmt.Errorf("Cannot convert %v to int64", valueStr)
100+
return 0, fmt.Errorf("cannot convert %v to int64", valueStr)
101101
}
102102
suffix := size[len(size)-1:]
103103
var mult int64
@@ -109,7 +109,7 @@ func SizeSuffixToInt64(size string) (int64, error) {
109109
case "g", "G":
110110
mult = 1024 * 1024 * 1024
111111
default:
112-
return value, fmt.Errorf("Invalid suffix: %v", suffix)
112+
return value, fmt.Errorf("invalid suffix: %v", suffix)
113113
}
114114
return value * mult, nil
115115
}

tests/framework/framework.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,8 @@ spec:
473473
`
474474
name := RandomName("ing")
475475
var hostname string
476-
if opt.IngressOpt.CustomHostName != nil {
477-
hostname = *opt.IngressOpt.CustomHostName
476+
if opt.CustomHostName != nil {
477+
hostname = *opt.CustomHostName
478478
} else {
479479
hostname = name + ".local"
480480
}
@@ -483,11 +483,11 @@ spec:
483483
ing.Name = name
484484
ing.Spec.Rules[0].Host = hostname
485485
ing.Spec.Rules[0].HTTP.Paths[0].Backend.Service.Name = svc.Name
486-
if opt.IngressOpt.CustomTLSSecret != "" {
486+
if opt.CustomTLSSecret != "" {
487487
ing.Spec.TLS = []networking.IngressTLS{{
488-
SecretName: opt.IngressOpt.CustomTLSSecret,
488+
SecretName: opt.CustomTLSSecret,
489489
}}
490-
} else if opt.IngressOpt.DefaultTLS {
490+
} else if opt.DefaultTLS {
491491
ing.Spec.TLS = []networking.IngressTLS{{SecretName: ""}}
492492
}
493493
if len(ing.Spec.TLS) > 0 && hostname != "" {

tests/framework/options/objects.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,24 @@ func AddConfigKeyAnnotation(key, value string) Object {
1919

2020
func DefaultTLS() Object {
2121
return func(o *objectOpt) {
22-
o.IngressOpt.DefaultTLS = true
22+
o.DefaultTLS = true
2323
}
2424
}
2525

2626
func CustomTLS(secret string) Object {
2727
return func(o *objectOpt) {
28-
o.IngressOpt.CustomTLSSecret = secret
28+
o.CustomTLSSecret = secret
2929
}
3030
}
3131

3232
func CustomHostName(hostname string) Object {
3333
return func(o *objectOpt) {
34-
o.IngressOpt.CustomHostName = ptr.To(hostname)
34+
o.CustomHostName = ptr.To(hostname)
3535
}
3636
}
3737
func Listener(name, proto string, port int32) Object {
3838
return func(o *objectOpt) {
39-
o.GatewayOpt.Listeners = append(o.GatewayOpt.Listeners, ListenerOpt{
39+
o.Listeners = append(o.Listeners, ListenerOpt{
4040
Name: name,
4141
Proto: proto,
4242
Port: port,

0 commit comments

Comments
 (0)