Skip to content

Commit e646bc4

Browse files
committed
Bump golangci-lint to 2.12.2
- Rename gomodguard to gomodguard_v2 in golangci-lint config Signed-off-by: Sean Chittenden <sean.chittenden@crowdstrike.com>
1 parent a336b8f commit e646bc4

18 files changed

Lines changed: 73 additions & 41 deletions

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: golangci-lint
1717
uses: golangci/golangci-lint-action@v9
1818
with:
19-
version: v2.11.4
19+
version: v2.12.2
2020
args: --fix --build-tags "integration core plugins plugin_security plugin_index_management multinode"
2121

2222
prettify:

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ linters:
2929
- godox
3030
- goheader
3131
- gomoddirectives
32-
- gomodguard
32+
- gomodguard_v2
3333
- goprintffuncname
3434
- gosec
3535
- govet

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
SHELL := /bin/bash
22

33
# Tool versions
4-
GOLANGCI_LINT_VERSION := v2.11.4
4+
GOLANGCI_LINT_VERSION := v2.12.2
55

66
GOLANGCI_LINT_BUILD_TAGS := "integration core plugins plugin_security plugin_index_management multinode"
77

opensearchtransport/cluster_health.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ import (
3434
"time"
3535
)
3636

37+
const clusterStatusRed = "red"
38+
3739
// NodeStatsResponse represents the response from GET /_nodes/_local/stats/jvm,breaker,thread_pool.
3840
// Only the "nodes" map is used; the top-level "_nodes" and "cluster_name" fields are ignored.
3941
// All fields are present in OpenSearch 1.3.0+.
@@ -266,7 +268,7 @@ func (c *Client) evaluateOverload(conn *Connection, stats *NodeStats) bool {
266268
health := conn.mu.clusterHealth
267269
conn.mu.RUnlock()
268270

269-
if health != nil && health.Status == "red" {
271+
if health != nil && health.Status == clusterStatusRed {
270272
if dl := loadDebugLogger(); dl != nil {
271273
dl.Logf("Node %q overloaded: cluster status is red\n", conn.URL)
272274
}

opensearchtransport/cluster_health_internal_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,7 +1163,7 @@ func TestEvaluateOverload(t *testing.T) {
11631163
c := makeClient()
11641164
conn := makeConn()
11651165
conn.mu.Lock()
1166-
conn.mu.clusterHealth = &ClusterHealthLocal{Status: "red"}
1166+
conn.mu.clusterHealth = &ClusterHealthLocal{Status: clusterStatusRed}
11671167
conn.mu.Unlock()
11681168

11691169
stats := &NodeStats{
@@ -1205,7 +1205,7 @@ func TestEvaluateOverload(t *testing.T) {
12051205
c := makeClient()
12061206
conn := makeConn()
12071207
conn.mu.Lock()
1208-
conn.mu.clusterHealth = &ClusterHealthLocal{Status: "red"}
1208+
conn.mu.clusterHealth = &ClusterHealthLocal{Status: clusterStatusRed}
12091209
conn.mu.Unlock()
12101210

12111211
stats := &NodeStats{

opensearchtransport/connection_lifecycle.go

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -286,23 +286,39 @@ func (lc connLifecycle) hasAny(flags connLifecycle) bool {
286286
return lc&flags != 0
287287
}
288288

289+
// Lifecycle state names used in String() output and test assertions.
290+
const (
291+
lcNameReady = "ready"
292+
lcNameUnknown = "unknown"
293+
lcNameActive = "active"
294+
lcNameStandby = "standby"
295+
lcNameNeedsWarmup = "needsWarmup"
296+
lcNameOverloaded = "overloaded"
297+
lcNameHealthChecking = "healthChecking"
298+
lcNameDraining = "draining"
299+
lcNameNeedsHardware = "needsHardware"
300+
lcNameNeedsCatUpdate = "needsCatUpdate"
301+
lcNameClusterHealthProbed = "clusterHealthProbed"
302+
lcNameClusterHealthAvailable = "clusterHealthAvailable"
303+
)
304+
289305
// connLifecycleBits maps each bit to its human-readable name.
290306
var connLifecycleBits = [12]struct { //nolint:gochecknoglobals // lookup table, not mutable state
291307
bit connLifecycle
292308
name string
293309
}{
294-
{lcReady, "ready"},
295-
{lcUnknown, "unknown"},
296-
{lcActive, "active"},
297-
{lcStandby, "standby"},
298-
{lcNeedsWarmup, "needsWarmup"},
299-
{lcOverloaded, "overloaded"},
300-
{lcHealthChecking, "healthChecking"},
301-
{lcDraining, "draining"},
302-
{lcNeedsHardware, "needsHardware"},
303-
{lcNeedsCatUpdate, "needsCatUpdate"},
304-
{lcClusterHealthProbed, "clusterHealthProbed"},
305-
{lcClusterHealthAvailable, "clusterHealthAvailable"},
310+
{lcReady, lcNameReady},
311+
{lcUnknown, lcNameUnknown},
312+
{lcActive, lcNameActive},
313+
{lcStandby, lcNameStandby},
314+
{lcNeedsWarmup, lcNameNeedsWarmup},
315+
{lcOverloaded, lcNameOverloaded},
316+
{lcHealthChecking, lcNameHealthChecking},
317+
{lcDraining, lcNameDraining},
318+
{lcNeedsHardware, lcNameNeedsHardware},
319+
{lcNeedsCatUpdate, lcNameNeedsCatUpdate},
320+
{lcClusterHealthProbed, lcNameClusterHealthProbed},
321+
{lcClusterHealthAvailable, lcNameClusterHealthAvailable},
306322
}
307323

308324
// String returns a human-readable name for the lifecycle.

opensearchtransport/policy_cluster_coordinator.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ type CoordinatorPolicy struct {
4747
policyState atomic.Int32 // Bitfield: psEnabled|psDisabled|psEnvEnabled|psEnvDisabled
4848
}
4949

50-
func (p *CoordinatorPolicy) policyTypeName() string { return "coordinator" }
50+
func (p *CoordinatorPolicy) policyTypeName() string { return policyTypeNameCoordinator }
5151
func (p *CoordinatorPolicy) setEnvOverride(enabled bool) { psSetEnvOverride(&p.policyState, enabled) }
5252

5353
// NewCoordinatorPolicy creates a policy that routes to coordinating-only nodes.
@@ -61,7 +61,7 @@ func NewCoordinatorPolicy() Policy {
6161
func (p *CoordinatorPolicy) configurePolicySettings(config policyConfig) error {
6262
// Create pool with proper settings if we don't have one yet
6363
if p.pool == nil {
64-
config.name = "coordinator"
64+
config.name = policyTypeNameCoordinator
6565
p.pool = createPoolFromConfig(config)
6666
}
6767
return nil

opensearchtransport/policy_doc_router.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ type DocRouter struct {
5050
config policyConfig
5151
}
5252

53-
func (p *DocRouter) policyTypeName() string { return "document_router" }
53+
func (p *DocRouter) policyTypeName() string { return policyTypeNameDocumentRouter }
5454
func (p *DocRouter) setEnvOverride(enabled bool) {
5555
psSetEnvOverride(&p.policyState, enabled)
5656
}

opensearchtransport/policy_ifenabled.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ type IfEnabledPolicy struct {
5252
policyState atomic.Int32 // Bitfield: psEnabled|psDisabled|psEnvEnabled|psEnvDisabled
5353
}
5454

55-
func (p *IfEnabledPolicy) policyTypeName() string { return "ifenabled" }
55+
func (p *IfEnabledPolicy) policyTypeName() string { return policyTypeNameIfEnabled }
5656
func (p *IfEnabledPolicy) setEnvOverride(enabled bool) { psSetEnvOverride(&p.policyState, enabled) }
5757

5858
// NewIfEnabledPolicy creates a new conditional policy.

opensearchtransport/policy_index_router.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ type IndexRouter struct {
173173
config policyConfig
174174
}
175175

176-
func (p *IndexRouter) policyTypeName() string { return "index_router" }
176+
func (p *IndexRouter) policyTypeName() string { return policyTypeNameIndexRouter }
177177
func (p *IndexRouter) setEnvOverride(enabled bool) { psSetEnvOverride(&p.policyState, enabled) }
178178

179179
// NewIndexRouter creates an IndexRouter with the given cache configuration.

0 commit comments

Comments
 (0)