Skip to content

feat(rules): add comprehensive built-in Go review guidance - #569

Merged
lizhengfeng101 merged 2 commits into
alibaba:mainfrom
amh1k:feat/go-built-in-review-rules
Jul 29, 2026
Merged

feat(rules): add comprehensive built-in Go review guidance#569
lizhengfeng101 merged 2 commits into
alibaba:mainfrom
amh1k:feat/go-built-in-review-rules

Conversation

@amh1k

@amh1k amh1k commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Description

Adds built-in, Go-specific review rules and maps **/*.go files to them.

The new rule focuses on high-confidence Go correctness, concurrency, resource lifecycle, boundary, and security findings. It requires evidence before reporting non-local concerns and avoids duplicating findings better handled by gofmt, go vet, Staticcheck, the compiler, or the race detector.

It preserves OCR’s default exclusion of *_test.go files.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactoring (no functional changes)
  • Documentation update
  • CI / Build / Tooling

How Has This Been Tested?

  • make test passes locally

  • Manual testing (describe below)

  • Ran go test ./... successfully.

  • Added resolver coverage confirming root, nested, and uppercase .GO paths select the built-in **/*.go rule.

  • Confirmed existing *_test.go exclusion coverage remains passing.

Checklist

  • My code follows the project's coding style (go fmt, go vet)
  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective or my feature works
  • New and existing unit tests pass locally with my changes
  • I have updated the documentation accordingly (if applicable)
  • I have signed the CLA

Related Issues

Closes #550

@github-actions

Copy link
Copy Markdown
Contributor

OpenCodeReview: No comments generated. Looks good to me.

@lizhengfeng101 lizhengfeng101 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice work overall — the rule doc is thorough and well-structured.

One suggestion: consider removing the #### References section at the end of go.md.

  1. No other rule doc (python.md, java.md, etc.) includes a references section — this breaks consistency.
  2. The rule doc serves as a system prompt for the AI reviewer, which cannot follow URLs. The links are not actionable.
  3. The behavioral guidance embedded in that section ("don't turn style preferences into findings", "check stdlib docs before reporting") is already covered throughout the body (the opening paragraph's tooling-dedup instruction, per-section "Confirm … before reporting" clauses, etc.).

Removing it keeps the doc focused and consistent with the rest of the rule set.

@amh1k

amh1k commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Nice work overall — the rule doc is thorough and well-structured.

One suggestion: consider removing the #### References section at the end of go.md.

1. No other rule doc (`python.md`, `java.md`, etc.) includes a references section — this breaks consistency.

2. The rule doc serves as a system prompt for the AI reviewer, which cannot follow URLs. The links are not actionable.

3. The behavioral guidance embedded in that section ("don't turn style preferences into findings", "check stdlib docs before reporting") is already covered throughout the body (the opening paragraph's tooling-dedup instruction, per-section "Confirm … before reporting" clauses, etc.).

Removing it keeps the doc focused and consistent with the rest of the rule set.

I have implemented your suggestions

@lizhengfeng101 lizhengfeng101 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@lizhengfeng101
lizhengfeng101 merged commit 3017dc1 into alibaba:main Jul 29, 2026
7 checks passed
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.

[Feature Request] Add built-in Go (Golang) code review rules

2 participants