generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2342f0
commit 0260f48
Showing
1 changed file
with
14 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
description: Rules for writing Go code | ||
globs: **/*.go | ||
alwaysApply: false | ||
--- | ||
|
||
- Always handle errors. | ||
- Always wrap errors using `fmt.Errorf("...: %w", err)` | ||
- Never use pointers to represent optional values, always use `github.com/alecthomas/types/optional.Option[T]` | ||
- For tests, always use github.com/alecthomas/assert for assertions. | ||
- When using assert.Equal, the parameters are `assert.Equal(t, <expected>, <actual>)` in that order. | ||
- Always update or create tests for new changes to Go code. | ||
- After making changes to Go files, always run tests. | ||
- Never use `os.Getenv()` outside of `main()` |