docs: add STYLE.md with Go style guide#2186
Open
EItanya wants to merge 3 commits into
Open
Conversation
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a repository-level style guide (STYLE.md) intended to centralize recurring review feedback and document established coding conventions, with detailed coverage for Go and stub sections for Python/TypeScript/Helm to be completed later.
Changes:
- Adds a new top-level
STYLE.mdcovering cross-language principles and Go-specific conventions (errors, interfaces, CRD design, controller patterns, testing). - Establishes RFC2119-style normative language (MUST/SHOULD/MAY) for review-enforced rules.
- Adds TODO stub sections for Python, TypeScript, and Helm/YAML for follow-up expansion.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+116
to
+118
| - When the shape of data is known at compile time, define a named struct. | ||
| `map[string]interface{}` **MUST NOT** be used for data whose schema you | ||
| control; it is reserved for genuinely schema-less JSON. |
Comment on lines
+194
to
+195
| - Keep exactly **one** constructor per type with all parameters; don't | ||
| accumulate `NewXxxWithYyy` convenience shims. |
Contributor
Author
There was a problem hiding this comment.
We should fix the existing deviations not add more
| garbage-collected with the parent. Use finalizers when cleanup involves | ||
| anything beyond owned K8s objects; adding a finalizer returns | ||
| `ctrl.Result{Requeue: true}`. | ||
| - All controllers set `NeedLeaderElection: new(true)`. |
Contributor
Author
There was a problem hiding this comment.
this code works in the latest golang
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a style guide covering general cross-language principles and Go conventions, derived from existing code patterns and recurring PR review feedback. Python/TypeScript/Helm sections are stubbed for follow-up.
The goal is to reduce repeated style feedback in reviews by documenting the conventions in one place.