-
Notifications
You must be signed in to change notification settings - Fork 283
Add Copilot PR review instructions for modern Go 1.26 patterns #7316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,28 @@ | ||||||
| applyTo: | ||||||
| - "**/*.go" | ||||||
| --- | ||||||
| # Modern Go (1.26+) — PR Review Guidelines | ||||||
|
|
||||||
| This project uses **Go 1.26** (`cli/azd/go.mod`). Do not flag modern Go 1.26 | ||||||
| features as errors. | ||||||
|
|
||||||
| ## `new(expr)` creates typed pointers from values | ||||||
|
|
||||||
| `new(false)`, `new(true)`, `new(0)`, `new("s")` are **valid Go 1.26**. They | ||||||
| create a pointer to the given value. This replaces helper functions like | ||||||
| `to.Ptr(val)`. Do NOT suggest `boolPtr()` or `&localVar` replacements. | ||||||
|
|
||||||
| ## Other modern patterns to accept (not flag) | ||||||
|
|
||||||
| - `errors.AsType[*T](err)` — generic error unwrapping (replaces `var e *T; errors.As(err, &e)`) | ||||||
|
||||||
| - `errors.AsType[*T](err)` — generic error unwrapping (replaces `var e *T; errors.As(err, &e)`) | |
| - `errors.AsType[*T](err)` — project-specific (non-stdlib) generic error unwrapping helper (replaces `var e *T; errors.As(err, &e)`) |
Copilot
AI
Mar 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wg.Go(...) is not a method on sync.WaitGroup in typical Go usage; documenting it as “WaitGroup shorthand” may cause the reviewer to miss a real issue when wg is a plain sync.WaitGroup. If this refers to a specific type used in this repo (e.g., errgroup.Group, a custom wrapper, or another concurrency helper), clarify which type/package wg is expected to be.
| - `wg.Go(func() { ... })` — WaitGroup shorthand (replaces `wg.Add(1); go func() { defer wg.Done(); ... }()`) | |
| - `g.Go(func() { ... })` — helper on concurrency groups (for example `errgroup.Group`) that wraps `wg.Add(1); go func() { defer wg.Done(); ... }()` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This hard-codes a specific Go version in reviewer instructions. To reduce maintenance churn (and avoid stale guidance if the toolchain changes), consider wording this to follow the
godirective incli/azd/go.mod(e.g., “This project targets the Go version declared incli/azd/go.mod” / “Go 1.26+”), rather than asserting a fixed version in the instructions text.