We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
When reviewing Go code, if I run into a situation where I see an unnecessary deviation from idiomatic Go style or best practice, I add an entry here complete with some rationale, and link to it.
I can do this for the smallest and most subtle of details, since I care about Go a lot. I can reuse this each time the same issue comes up, instead of having to re-write the rationale multiple times, or skip explaining why I make a given suggestion.
You can view this as my supplement to https://go.dev/s/style.
This page is generated from the entries with label "Accepted" here. If you'd like to add a new suggestion, please provide convincing rationale and references (e.g., links to places in Go project that support your suggestion), and open a new issue. It'll show up here when I add an "Accepted" label.
- Use consistent spelling of certain words
- Single spaces between sentences
- Error variable naming
- For brands or words with more than 1 capital letter, lowercase all letters
- Comments for humans always have a single space after the slashes
- Use singular form for collection repo/folder name
- Avoid unused method receiver names
- Empty string check
- Mutex hat
- Don't os.Exit(2) inside flag.Usage
continue reading on dmitri.shuralyov.com
⚠️ This post links to an external website. ⚠️
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.