c101452bb5
- Refactored and condensed numerous system prompts, agent instructions, and tool documentation files across packages. - Streamlined workflow rules, formatting constraints, and execution guidelines for improved clarity and brevity. - Updated discovery rules, recommendation criteria, and syntax standards in prompt templates.
928 B
928 B
description, interruptMode, scope, astCondition
| description | interruptMode | scope | astCondition | |
|---|---|---|---|---|
| Use for i := range n instead of the C-style for i := 0; i < n; i++ loop (Go 1.22) | never | tool:edit(*.go), tool:write(*.go) |
|
Go 1.22: for ranges integers. For i := 0; i < n; i++, prefer for i := range n; if index unused, for range n.
Avoid
for i := 0; i < n; i++ {
use(i)
}
for i := 0; i < len(s); i++ {
use(s[i])
}
Use
for i := range n {
use(i)
}
// Ranging the slice directly is usually clearer than indexing.
for i := range s {
use(s[i])
}
// Index unused → drop it entirely.
for range n {
tick()
}
Exceptions
- Keep explicit: non-zero start; step other than
++; descending (for i := n - 1; i >= 0; i--). - Keep explicit if body reassigns loop variable or depends on
isurviving past loop. - Requires Go 1.22+. If module
godirective older, keep classic loop.