Fix Go linting errors in known_needs_expressions_test.go#16292
Conversation
- Use require.Positive instead of require.Greater(t, x, 0) for testifylint compliance - Remove unused promptSection variable assignment to fix staticcheck SA4006 - Add comment explaining the unused variable for future reference Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes three Go linting violations in pkg/workflow/known_needs_expressions_test.go identified by the CI lint step: two testifylint negative-positive violations and one staticcheck SA4006 unused variable violation.
Changes:
- Replaced
require.Greater(t, x, 0)withrequire.Positive(t, x)for idiomatic positive value assertions (testifylint compliance) - Removed unused
promptSectionvariable assignment (staticcheck SA4006 fix)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Get the prompt creation section (not currently used but kept for potential future checks) | ||
| _ = lockStr[promptStepStart:] | ||
|
|
There was a problem hiding this comment.
Computing a value just to assign it to the blank identifier is unnecessary and wasteful. If this section extraction is not being used for any assertions, both the comment and the computation should be removed entirely. The test already verifies the prompt step exists via the require.Positive check at line 522 and the assert.Contains check at line 530.
| // Get the prompt creation section (not currently used but kept for potential future checks) | |
| _ = lockStr[promptStepStart:] |
CI lint step failing with 3 violations in
pkg/workflow/known_needs_expressions_test.go:promptSectionvariable assignmentrequire.Greater(t, x, 0)flaggedChanges
require.Greater(t, x, 0)withrequire.Positive(t, x)for idiomatic positive value assertionspromptSectioncalculation, replace with blank identifier_and explanatory commentOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.