fn: fix printf vet check in TestSomeToOkf Go 1.24+
What changed, and why it matters
This is a minor test-only code change that updates a unit test to satisfy a stricter Go compiler/static analysis rule introduced in Go 1.24. It does not change any production code, user-facing behavior, or security-sensitive logic.
No security action needed. This is a routine test maintenance patch.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies fn/option_test.go to replace a variable string argument with a constant format string in TestSomeToOkf. Go 1.24’s printf vet check requires format strings to be constant when arguments are passed. The test now passes a constant errFmt with a format argument, matching the expected signature and behavior of SomeToOkf. No runtime or security behavior changes.
Changed components
fn/option_test.goInspect captured patch +4 / −4
diff --git a/fn/option_test.go b/fn/option_test.go
index 69f6608..9151104 100644
--- a/fn/option_test.go
+++ b/fn/option_test.go
@@ -20,11 +20,11 @@ func TestSomeToOk(t *testing.T) {
}
func TestSomeToOkf(t *testing.T) {
- errStr := "err"
- require.Equal(t, Some(1).SomeToOkf(errStr), Ok(1))
+ const errFmt = "missing value: %s"
+ require.Equal(t, Some(1).SomeToOkf(errFmt, "test"), Ok(1))
require.Equal(
- t, None[uint8]().SomeToOkf(errStr),
- Err[uint8](fmt.Errorf(errStr)),
+ t, None[uint8]().SomeToOkf(errFmt, "test"),
+ Err[uint8](fmt.Errorf(errFmt, "test")),
)
}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.