-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Bug: Dead Code in flattenParams
File: internal/intent/parser.go
In the flattenParams function, the float64 branch has dead code — a complex string manipulation expression that is immediately overwritten on the very next line:
case float64:
if val == float64(int(val)) {
result[k] = strings.TrimRight(strings.TrimRight(
strings.Replace(
strings.Replace(
fmt.Sprintf("%f", val), ".", "", 1),
"0", "", -1),
"0"), "")
// Simpler: just use Sprintf ← comment left in from debugging
result[k] = fmt.Sprintf("%g", val) // ← overwrites the above
} else {
result[k] = fmt.Sprintf("%g", val)
}The if val == float64(int(val)) branch does the same thing as the else branch — both produce fmt.Sprintf("%g", val). The entire if/else can be collapsed to a single line.
Fix:
case float64:
result[k] = fmt.Sprintf("%g", val)Impact: No functional impact (result is the same), but dead code increases maintenance burden and signals incomplete refactoring.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working