Skip to content

Add Copilot PR review instructions for modern Go 1.26 patterns#7316

Merged
spboyer merged 1 commit intoAzure:mainfrom
kristenwomack:copilot-review-modern-go
Mar 26, 2026
Merged

Add Copilot PR review instructions for modern Go 1.26 patterns#7316
spboyer merged 1 commit intoAzure:mainfrom
kristenwomack:copilot-review-modern-go

Conversation

@kristenwomack
Copy link
Copy Markdown
Collaborator

Summary

Fixes #7315

The Copilot PR reviewer flagged 5 false positives on #7223 because it didn't recognize Go 1.26 features (new(expr) pointer literals) and incorrectly flagged imports that existed outside the diff context.

The modern Go patterns are documented in cli/azd/AGENTS.md, but the PR reviewer doesn't read that file — it reads .github/instructions/*.instructions.md.

Changes

  • .github/instructions/go.instructions.md — New instruction file scoped to **/*.go that tells the Copilot PR reviewer about:
    • new(expr) pointer literal syntax (Go 1.26)
    • Other modern Go patterns it should not flag (errors.AsType, for i := range n, t.Context(), wg.Go(), etc.)
    • Guidance to verify imports/symbols exist in unchanged file sections before flagging them as missing

The Copilot PR reviewer flagged 5 false positives on PR Azure#7223 because it
didn't know about Go 1.26 features (e.g. new(expr) for pointer literals)
and incorrectly flagged missing imports that existed outside the diff context.

These patterns are documented in cli/azd/AGENTS.md but the PR reviewer
reads .github/instructions/*.instructions.md files, not AGENTS.md.

This adds a focused Go-specific instruction file that covers:
- new(expr) pointer literal syntax (Go 1.26)
- Other modern Go patterns that should not be flagged
- Guidance to check full file context, not just diff hunks

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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

Adds Go-specific Copilot PR review instructions so automated reviews stop flagging Go 1.26+ language/features and avoid “missing import/symbol” false-positives when the diff doesn’t show full file context.

Changes:

  • Introduces .github/instructions/go.instructions.md scoped to **/*.go.
  • Documents accepted modern Go patterns (e.g., new(expr), integer range, test helpers).
  • Instructs the reviewer to validate imports/symbols against unchanged file sections before reporting issues.

@rajeshkamal5050
Copy link
Copy Markdown
Contributor

@kristenwomack I think once #7301 merges this becomes redundant since it already adds copilot-instructions.md pointing to AGENTS.md which has the Go 1.26 patterns. Can we close this one after #7301 lands?

@kristenwomack
Copy link
Copy Markdown
Collaborator Author

kristenwomack commented Mar 26, 2026

@kristenwomack I think once #7301 merges this becomes redundant since it already adds copilot-instructions.md pointing to AGENTS.md which has the Go 1.26 patterns. Can we close this one after #7301 lands?

This PR (#7316) is specific to Copilot's PR review process. The docs change in #7301 adds instructions to the docs. I'm open to the how we get this done, so please do make suggested changes, but we should have docs and also customize the copilot PR config.

The intension of this PR: add .github/instructions/go.instructions.md — a path-scoped instruction file with applyTo: "**/*.go".

In #7301, .github/copilot-instructions.md say "go read AGENTS.md" which apply globally. My change is intended to be specific about Go files only, so Copilot code review won't use its context window on Go-specific rules when reviewing other file types.

PR #7301 is fantastic, and this PR is intended to make Copilot actually read the relevant pages during Go file reviews.

Reference docs:

@spboyer spboyer enabled auto-merge (squash) March 26, 2026 23:29
@spboyer
Copy link
Copy Markdown
Member

spboyer commented Mar 26, 2026

/check-enforcer override

@spboyer spboyer merged commit b8fc909 into Azure:main Mar 26, 2026
7 checks passed
jongio pushed a commit to jongio/azure-dev that referenced this pull request Mar 27, 2026
…#7316)

The Copilot PR reviewer flagged 5 false positives on PR Azure#7223 because it
didn't know about Go 1.26 features (e.g. new(expr) for pointer literals)
and incorrectly flagged missing imports that existed outside the diff context.

These patterns are documented in cli/azd/AGENTS.md but the PR reviewer
reads .github/instructions/*.instructions.md files, not AGENTS.md.

This adds a focused Go-specific instruction file that covers:
- new(expr) pointer literal syntax (Go 1.26)
- Other modern Go patterns that should not be flagged
- Guidance to check full file context, not just diff hunks

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jongio pushed a commit to jongio/azure-dev that referenced this pull request Mar 27, 2026
…#7316)

The Copilot PR reviewer flagged 5 false positives on PR Azure#7223 because it
didn't know about Go 1.26 features (e.g. new(expr) for pointer literals)
and incorrectly flagged missing imports that existed outside the diff context.

These patterns are documented in cli/azd/AGENTS.md but the PR reviewer
reads .github/instructions/*.instructions.md files, not AGENTS.md.

This adds a focused Go-specific instruction file that covers:
- new(expr) pointer literal syntax (Go 1.26)
- Other modern Go patterns that should not be flagged
- Guidance to check full file context, not just diff hunks

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jongio pushed a commit to jongio/azure-dev that referenced this pull request Mar 27, 2026
…#7316)

The Copilot PR reviewer flagged 5 false positives on PR Azure#7223 because it
didn't know about Go 1.26 features (e.g. new(expr) for pointer literals)
and incorrectly flagged missing imports that existed outside the diff context.

These patterns are documented in cli/azd/AGENTS.md but the PR reviewer
reads .github/instructions/*.instructions.md files, not AGENTS.md.

This adds a focused Go-specific instruction file that covers:
- new(expr) pointer literal syntax (Go 1.26)
- Other modern Go patterns that should not be flagged
- Guidance to check full file context, not just diff hunks

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

Add Copilot PR review instructions for modern Go (1.26) patterns

5 participants