From 180db0fd73361155c20f9c041a585be86daf91a3 Mon Sep 17 00:00:00 2001 From: Victor Login Date: Fri, 17 Nov 2023 17:09:57 +0100 Subject: [PATCH] adr: 29 Go: Key Recommendations Signed-off-by: Victor Login --- docs/ADR/README.md | 1 + .../decisions/0029-go-key-recommendations.md | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 docs/ADR/decisions/0029-go-key-recommendations.md diff --git a/docs/ADR/README.md b/docs/ADR/README.md index 20cf0f1f352..19d6d9d6c4f 100644 --- a/docs/ADR/README.md +++ b/docs/ADR/README.md @@ -51,5 +51,6 @@ for information team about cases for updated ADR. - [ADR-0017](./decisions/0017-profile-guided-optimization.md) - Profile-guided optimization - [ADR-0027](./decisions/0027-orm-and-golang.md) - ORM and Golang [Cookbook] - [ADR-0028](./decisions/0028-go-and-debug-concurrency.md) - Go and debug concurrency + - [ADR-0029](./decisions/0029-go-key-recommendations.md) - Go: Key Recommendations - **Front-end** - [ADR-0019](./decisions/0019-front-end-testing.md) - Front-end testings diff --git a/docs/ADR/decisions/0029-go-key-recommendations.md b/docs/ADR/decisions/0029-go-key-recommendations.md new file mode 100644 index 00000000000..f43ebd3ccc8 --- /dev/null +++ b/docs/ADR/decisions/0029-go-key-recommendations.md @@ -0,0 +1,29 @@ +# 29. Go: Key Recommendations + +Date: 2023-11-17 + +## Status + +Accepted + +## Context + +In our quest to enhance the quality and reliability of our Go codebase, we identified the need for robust tools and guidelines. +Effective linting, handling of nil pointers, and adherence to a consistent style guide are essential for maintaining code quality. + +## Decision + +1. **Adopt `golangci-lint`**: This comprehensive linter will be our primary tool for identifying and fixing issues in our Go code. + +2. **Implement `nilaway` by Uber**: To specifically address nil pointer errors, +we will utilize [Uber's `nilaway`](https://github.com/uber-go/nilaway). + +3. **Follow the Uber Go Style Guide**: Our coding style will align with the [Uber Go Style Guide](https://github.com/uber-go/guide), +ensuring consistency and adherence to industry best practices. + +## Consequences + +- **Easier Code Maintenance**: With `golangci-lint`, identifying and fixing stylistic and logical errors becomes more streamlined. +- **Reduced Nil Pointer Errors**: `nilaway` will significantly lower the risk of nil pointer dereferences, one of the common pitfalls in Go. +- **Consistent Coding Style**: By adhering to the Uber Go Style Guide, our codebase will be more uniform and easier to read, +which is beneficial for both current and future team members.