Skip to content

Commit ec38067

Browse files
Claudeclaude
andcommitted
Fix gosec G602 slice bounds warning
- Truncate parts slice to max 3 elements before loop - Add nolint comment for false positive gosec warning - Update golangci-lint version to 2.6.2 to match CI 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 5445b73 commit ec38067

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

container/internal/tui/initialization_commands.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,21 @@ func semverCompare(a, b string) int {
5656
}
5757
parts := strings.Split(s, ".")
5858
result := make([]int, 3)
59-
for i := 0; i < 3 && i < len(parts); i++ {
59+
// Limit to first 3 parts
60+
if len(parts) > 3 {
61+
parts = parts[:3]
62+
}
63+
for i, part := range parts {
6064
// best-effort parse
6165
n := 0
62-
for _, ch := range parts[i] {
66+
for _, ch := range part {
6367
if ch >= '0' && ch <= '9' {
6468
n = n*10 + int(ch-'0')
6569
} else {
6670
break
6771
}
6872
}
69-
result[i] = n
73+
result[i] = n //nolint:gosec // Safe: parts is truncated to max 3 elements above
7074
}
7175
return result
7276
}

container/justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Catnip Go Server Development
22

33
# Configuration
4-
GOLANGCI_LINT_VERSION := "2.3.0"
4+
GOLANGCI_LINT_VERSION := "2.6.2"
55

66
# Build the unified catnip binary
77
build: swagger build-frontend build-scripts

0 commit comments

Comments
 (0)