Skip to content

fix(lint): use require.NoError for error assertion in gitutil_test.go#24817

Merged
pelikhan merged 1 commit intomainfrom
copilot/fix-lint-go
Apr 6, 2026
Merged

fix(lint): use require.NoError for error assertion in gitutil_test.go#24817
pelikhan merged 1 commit intomainfrom
copilot/fix-lint-go

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 6, 2026

testifylint was failing CI due to an error assertion using assert.NoError instead of require.NoError in TestFindGitRoot.

Change

  • pkg/gitutil/gitutil_test.go: replaced assert.NoErrorrequire.NoError and added the require import
// Before
assert.NoError(t, err, "FindGitRoot should succeed when running inside a git repository")

// After
require.NoError(t, err, "FindGitRoot should succeed when running inside a git repository")

require halts the test immediately on failure, preventing subsequent assertions from running against a zero/nil value.

@pelikhan pelikhan marked this pull request as ready for review April 6, 2026 03:23
Copilot AI review requested due to automatic review settings April 6, 2026 03:23
@pelikhan pelikhan merged commit 7a6faba into main Apr 6, 2026
50 of 51 checks passed
@pelikhan pelikhan deleted the copilot/fix-lint-go branch April 6, 2026 03:23
Copy link
Copy Markdown
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

Updates TestFindGitRoot to satisfy testifylint by using fatal assertions for error setup checks.

Changes:

  • Replaced assert.NoError with require.NoError in TestFindGitRoot
  • Added the github.com/stretchr/testify/require import
Show a summary per file
File Description
pkg/gitutil/gitutil_test.go Switches the error assertion in TestFindGitRoot to require.NoError to align with testifylint’s setup-assertion expectations

Copilot's findings

Tip

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

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

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.

3 participants