Skip to content

Fix RadioFrequency string formatting#714

Merged
dharmab merged 1 commit into
mainfrom
fix/radio-frequency-string
Jul 26, 2026
Merged

Fix RadioFrequency string formatting#714
dharmab merged 1 commit into
mainfrom
fix/radio-frequency-string

Conversation

@dharmab

@dharmab dharmab commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Context

Split off from #712, which found this while working in the same area.

RadioFrequency.String() had a transposed format verb ("%f.3%s") and formatted the frequency in hertz rather than megahertz, so 251MHz AM rendered as "251000000.000000.3AM" instead of "251.000AM". go vet doesn't catch it because %f is a valid verb for a float64 and .3 reads as literal text.

Nothing calls String() today, so this is latent rather than user-visible.

Fix

fmt.Sprintf("%.3f%s", f.Frequency.Megahertz(), suffix), plus a regression test.

Testing

make vet
go test ./pkg/simpleradio/... -run TestRadioFrequencyString -v

🤖 Generated with Claude Code

The verb was transposed ("%f.3%s") and printed hertz rather than
megahertz, so 251MHz AM rendered as "251000000.000000.3AM" instead of
"251.000AM". Nothing calls this today, so the bug was latent; go vet
doesn't catch it because %f is a valid verb for a float64 and ".3"
reads as literal text.

Co-Authored-By: Claude <noreply@anthropic.com>
@dharmab
dharmab force-pushed the fix/radio-frequency-string branch from de48678 to edc71fb Compare July 26, 2026 14:25
@dharmab dharmab changed the title Fix RadioFrequency.String() transposed format verb Fix RadioFrequency string formatting Jul 26, 2026
@dharmab
dharmab enabled auto-merge (rebase) July 26, 2026 14:26
@dharmab
dharmab merged commit 159c599 into main Jul 26, 2026
9 checks passed
@dharmab
dharmab deleted the fix/radio-frequency-string branch July 26, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant