Skip to content

Commit f5521ac

Browse files
committed
Bump golangci-lint to match go 1.25
1 parent acf710e commit f5521ac

14 files changed

Lines changed: 40 additions & 25 deletions

File tree

.golangci.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ linters:
3434
- nlreturn
3535
# Replaced by whitespace.
3636
- wsl
37+
# We do not enforce godoc comments.
38+
- godoclint
3739
# https://golangci-lint.run/usage/linters/
3840
enable:
3941
- asasalint
@@ -107,6 +109,14 @@ linters:
107109
text: 'G301: Expect directory permissions to be 0750 or less'
108110
- path: 'pkg/components/storage\.go'
109111
text: 'G302: Expect file permissions to be 0600 or less'
112+
- path: 'pkg/config/node\.go'
113+
text: 'G703: Path traversal via taint analysis'
114+
- path: 'pkg/controllers/kube-apiserver\.go'
115+
text: 'G703: Path traversal via taint analysis'
116+
- path: 'pkg/telemetry/telemetry\.go'
117+
text: 'G704: SSRF via taint analysis'
118+
- path: 'pkg/util/cryptomaterial/certchains/signers\.go'
119+
text: 'toBuilder returns interface'
110120
settings:
111121
cyclop:
112122
max-complexity: 20

cmd/generate-config/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func parseJSONValue(jsonType interface{}) (value string, node []*yaml.Node) {
145145
}
146146

147147
func schemaKeyToOrderedArray[K string | int, V any](schemaProperties map[K]V) []K {
148-
var ordered = []K{}
148+
var ordered = make([]K, 0, len(schemaProperties))
149149
for k := range schemaProperties {
150150
ordered = append(ordered, k)
151151
}

pkg/assets/unstructured.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,6 @@ var configClientCache = make(map[string]configClientCacheEntry, 1)
5252
var configClientCacheLock sync.RWMutex
5353

5454
type unstructuredClient struct {
55-
base dynamic.Interface
56-
mapper meta.ResettableRESTMapper
57-
58-
Client dynamic.ResourceInterface
59-
Discovery discovery.AggregatedDiscoveryInterface
60-
61-
unstructured *unstructured.Unstructured
62-
6355
// modify is a function that modifies the existing object based on the required object.
6456
// The first argument is a pointer to a boolean that should be set to true if the object was modified.
6557
// i.e. `*modified = true`
@@ -68,6 +60,14 @@ type unstructuredClient struct {
6860
// If Not set, the object will only have its metadata fields updated.
6961
// If set, the object will be modified based on the function.
7062
ModifyOnExists
63+
64+
base dynamic.Interface
65+
mapper meta.ResettableRESTMapper
66+
67+
Client dynamic.ResourceInterface
68+
Discovery discovery.AggregatedDiscoveryInterface
69+
70+
unstructured *unstructured.Unstructured
7171
}
7272

7373
func unstructuredConfigAndClient(kubeconfigPath string) (configClientCacheEntry, error) {

pkg/cmd/showConfig.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ import (
1212
)
1313

1414
type showConfigOptions struct {
15-
Mode string
1615
genericclioptions.IOStreams
16+
17+
Mode string
1718
}
1819

1920
func NewShowConfigCommand(ioStreams genericclioptions.IOStreams) *cobra.Command {

pkg/cmd/version.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import (
1414
)
1515

1616
type VersionOptions struct {
17-
Output string
18-
1917
genericclioptions.IOStreams
18+
19+
Output string
2020
}
2121

2222
func NewVersionOptions(ioStreams genericclioptions.IOStreams) *VersionOptions {

pkg/components/controllers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ func startDNSController(ctx context.Context, cfg *config.Config, kubeconfigPath
349349
// type list. Also quote/escape any characters that are special to HAProxy (\,', and ").
350350
// See http://cbonte.github.io/haproxy-dconv/2.2/configuration.html#2.2
351351
func getMIMETypes(mimeTypes []operatorv1.CompressionMIMEType) []string {
352-
mimes := []string{}
352+
mimes := make([]string, 0, len(mimeTypes))
353353

354354
for _, m := range mimeTypes {
355355
mimeType := string(m)

pkg/healthcheck/debug_info.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ type unpulledImage struct {
129129

130130
type failedImage struct {
131131
unpulledImage
132+
132133
Message string
133134
}
134135

pkg/mdns/controller.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616

1717
type MicroShiftmDNSController struct {
1818
sync.Mutex
19+
1920
NodeName string
2021
NodeIP string
2122
KubeConfig string
@@ -127,7 +128,7 @@ func ipInAddrs(ip string, addrs []net.Addr) bool {
127128
}
128129

129130
func addrsToStrings(addrs []net.Addr) []string {
130-
var ipAddrs = make([]string, 0)
131+
var ipAddrs = make([]string, 0, len(addrs))
131132

132133
for _, a := range addrs {
133134
ipAddr, _, _ := net.ParseCIDR(a.String())

pkg/mdns/server/resolver.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const defaultTTL = 120
2626

2727
type Resolver struct {
2828
sync.Mutex
29+
2930
domain map[string][]net.IP
3031
}
3132

@@ -38,7 +39,7 @@ func NewResolver() *Resolver {
3839
func (r *Resolver) AddDomain(name string, ipStrs []string) {
3940
r.Lock()
4041
defer r.Unlock()
41-
var ips = make([]net.IP, 0)
42+
var ips = make([]net.IP, 0, len(ipStrs))
4243

4344
for _, ip := range ipStrs {
4445
ips = append(ips, net.ParseIP(ip))

pkg/servicemanager/manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func (m *ServiceManager) Run(ctx context.Context, ready chan<- struct{}, stopped
7878

7979
for _, service := range services {
8080
// Compile a list of ready channels of the service's dependencies (if any).
81-
depsReadyList := []<-chan struct{}{}
81+
depsReadyList := make([]<-chan struct{}, 0, len(service.Dependencies()))
8282
for _, dependency := range service.Dependencies() {
8383
depsReadyList = append(depsReadyList, readyMap[dependency])
8484
}

0 commit comments

Comments
 (0)