Skip to content

Fix lint-go failure from perfsprint violations in CLI and permissions validator#31231

Merged
pelikhan merged 2 commits into
mainfrom
copilot/fix-lint-go-job-failure
May 9, 2026
Merged

Fix lint-go failure from perfsprint violations in CLI and permissions validator#31231
pelikhan merged 2 commits into
mainfrom
copilot/fix-lint-go-job-failure

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 9, 2026

Bug Fix

What was the bug?

The lint-go job failed in Actions job 75165548320 due to perfsprint violations: one unnecessary fmt.Sprintf and two static-string fmt.Errorf calls.

How did you fix it?

  • CLI formatting cleanup
    • Replaced formatted string construction with direct concatenation in pkg/cli/add_interactive_engine.go.
  • Static error construction cleanup
    • Replaced static-message fmt.Errorf(...) with errors.New(...) in pkg/workflow/permissions_compiler_validator.go.
    • Added errors import for the validator.
// before
fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf("Using coding agent: %s", c.EngineOverride)))
return fmt.Errorf("engine.auth.type: github-oidc requires permissions.id-token: write")

// after
fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Using coding agent: "+c.EngineOverride))
return errors.New("engine.auth.type: github-oidc requires permissions.id-token: write")

Testing

  • Scoped to behavior-preserving lint-driven refactors only; no functional logic changes were introduced.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix failing GitHub Actions job 'lint-go' Fix lint-go failure from perfsprint violations in CLI and permissions validator May 9, 2026
@pelikhan pelikhan marked this pull request as ready for review May 9, 2026 16:10
Copilot AI review requested due to automatic review settings May 9, 2026 16:10
@pelikhan pelikhan merged commit 60d2b01 into main May 9, 2026
@pelikhan pelikhan deleted the copilot/fix-lint-go-job-failure branch May 9, 2026 16:10
Copilot stopped work on behalf of pelikhan due to an error May 9, 2026 16:10
Copilot AI requested a review from pelikhan May 9, 2026 16:10
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

This PR fixes lint-go failures caused by perfsprint violations by removing unnecessary string formatting calls while keeping behavior the same.

Changes:

  • Replaced an unnecessary fmt.Sprintf with direct string concatenation in the interactive CLI engine selection flow.
  • Replaced static-message fmt.Errorf(...) calls with errors.New(...) in the permissions compiler validator (and added the errors import).
Show a summary per file
File Description
pkg/workflow/permissions_compiler_validator.go Uses errors.New for static error strings to satisfy perfsprint and keeps existing validator behavior.
pkg/cli/add_interactive_engine.go Removes an unnecessary fmt.Sprintf when printing the selected/overridden engine message.

Copilot's findings

Tip

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

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

Comment on lines 165 to +170
if workflowPermissions == nil {
return fmt.Errorf("engine.auth.type: github-oidc requires permissions.id-token: write")
return errors.New("engine.auth.type: github-oidc requires permissions.id-token: write")
}

if level, exists := workflowPermissions.Get(PermissionIdToken); !exists || level != PermissionWrite {
return fmt.Errorf("engine.auth.type: github-oidc requires permissions.id-token: write")
return errors.New("engine.auth.type: github-oidc requires permissions.id-token: write")
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