Skip to content

Commit f347259

Browse files
Claudeclaude
andcommitted
Fix gosec G602 slice bounds warning
Use range loop with explicit bounds check to satisfy stricter gosec checks in golangci-lint 2.6.2. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 5445b73 commit f347259

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

container/internal/tui/initialization_commands.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,13 @@ 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+
for i, part := range parts {
60+
if i >= 3 {
61+
break
62+
}
6063
// best-effort parse
6164
n := 0
62-
for _, ch := range parts[i] {
65+
for _, ch := range part {
6366
if ch >= '0' && ch <= '9' {
6467
n = n*10 + int(ch-'0')
6568
} else {

0 commit comments

Comments
 (0)