Skip to content

Fix Go linting errors in known_needs_expressions_test.go#16292

Merged
pelikhan merged 2 commits intocopilot/add-needs-expressions-generationfrom
copilot/lint-go-code-yet-again
Feb 17, 2026
Merged

Fix Go linting errors in known_needs_expressions_test.go#16292
pelikhan merged 2 commits intocopilot/add-needs-expressions-generationfrom
copilot/lint-go-code-yet-again

Conversation

Copy link
Contributor

Copilot AI commented Feb 17, 2026

CI lint step failing with 3 violations in pkg/workflow/known_needs_expressions_test.go:

  • staticcheck SA4006: unused promptSection variable assignment
  • testifylint negative-positive: two instances of require.Greater(t, x, 0) flagged

Changes

  • Replace require.Greater(t, x, 0) with require.Positive(t, x) for idiomatic positive value assertions
  • Remove unused promptSection calculation, replace with blank identifier _ and explanatory comment
// Before
require.Greater(t, substStepStart, 0, "Substitution step not found")
promptSection := lockStr[promptStepStart:]
nextStepIdx = strings.Index(promptSection[50:], "- name:")
if nextStepIdx > 0 {
    promptSection = promptSection[:50+nextStepIdx]
}

// After  
require.Positive(t, substStepStart, "Substitution step not found")
_ = lockStr[promptStepStart:]  // Reserved for potential future checks
Original prompt

Reference: https://github.com/github/gh-aw/actions/runs/22087569443/job/63825848554#step:7:1

Lint go


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

- 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>
Copilot AI changed the title [WIP] Add linting for Go code Fix Go linting errors in known_needs_expressions_test.go Feb 17, 2026
Copilot AI requested a review from pelikhan February 17, 2026 06:08
@pelikhan pelikhan marked this pull request as ready for review February 17, 2026 06:13
Copilot AI review requested due to automatic review settings February 17, 2026 06:13
@pelikhan pelikhan merged commit e7fd4eb into copilot/add-needs-expressions-generation Feb 17, 2026
@pelikhan pelikhan deleted the copilot/lint-go-code-yet-again branch February 17, 2026 06:13
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) with require.Positive(t, x) for idiomatic positive value assertions (testifylint compliance)
  • Removed unused promptSection variable assignment (staticcheck SA4006 fix)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +524 to 526
// Get the prompt creation section (not currently used but kept for potential future checks)
_ = lockStr[promptStepStart:]

Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
// Get the prompt creation section (not currently used but kept for potential future checks)
_ = lockStr[promptStepStart:]

Copilot uses AI. Check for mistakes.
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.

2 participants

Comments