diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2024-02-25 14:05:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-25 13:05:23 +0000 |
commit | ad0a34b492c3d41952ff4648c8bfb7b54c376151 (patch) | |
tree | 3baacd6be322061bd9d53db7c61f7b82e4fa3f72 /docs | |
parent | 0676bf52f95b9c9ac6f5679bd263d844e6a83fa1 (diff) | |
download | gitea-ad0a34b492c3d41952ff4648c8bfb7b54c376151.tar.gz gitea-ad0a34b492c3d41952ff4648c8bfb7b54c376151.zip |
Add `io.Closer` guidelines (#29387)
Co-authored-by: Yarden Shoham <git@yardenshoham.com>
Diffstat (limited to 'docs')
-rw-r--r-- | docs/content/contributing/guidelines-backend.en-us.md | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/docs/content/contributing/guidelines-backend.en-us.md b/docs/content/contributing/guidelines-backend.en-us.md index 084b3886e8..3159a5ff7d 100644 --- a/docs/content/contributing/guidelines-backend.en-us.md +++ b/docs/content/contributing/guidelines-backend.en-us.md @@ -101,6 +101,10 @@ i.e. `services/user`, `models/repository`. Since there are some packages which use the same package name, it is possible that you find packages like `modules/user`, `models/user`, and `services/user`. When these packages are imported in one Go file, it's difficult to know which package we are using and if it's a variable name or an import name. So, we always recommend to use import aliases. To differ from package variables which are commonly in camelCase, just use **snake_case** for import aliases. i.e. `import user_service "code.gitea.io/gitea/services/user"` +### Implementing `io.Closer` + +If a type implements `io.Closer`, calling `Close` multiple times must not fail or `panic` but return an error or `nil`. + ### Important Gotchas - Never write `x.Update(exemplar)` without an explicit `WHERE` clause: |