Enhance Go development instructions by emphasizing the use of early return patterns to improve code clarity
This commit is contained in:
parent
94d5157bf2
commit
d78046f93a
@ -14,6 +14,7 @@ Follow idiomatic Go practices and community standards when writing Go code. Thes
|
|||||||
- Follow the principle of least surprise
|
- Follow the principle of least surprise
|
||||||
- Keep the happy path left-aligned (minimize indentation)
|
- Keep the happy path left-aligned (minimize indentation)
|
||||||
- Return early to reduce nesting
|
- Return early to reduce nesting
|
||||||
|
- Prefer early return over if-else chains; use `if condition { return }` pattern to avoid else blocks
|
||||||
- Make the zero value useful
|
- Make the zero value useful
|
||||||
- Write self-documenting code with clear, descriptive names
|
- Write self-documenting code with clear, descriptive names
|
||||||
- Document exported types, functions, methods, and packages
|
- Document exported types, functions, methods, and packages
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user