Fix review issues: front matter, headings, consistency, typos
All checks were successful
check / check (push) Successful in 9s
All checks were successful
check / check (push) Successful in 9s
- Move title and last_modified to YAML front matter (all policy docs) - Make all document sections H1, subsections H2 - Update version rule to reference front matter format - Fix "our" → "your" typo in Go styleguide - Fix Python styleguide numbering (2. → 1.) - Fix README: "flat collection" → accurate description, remove stale TODO - Remove Makefile items from code styleguides (repo stuff, not code), add note linking to Repository Policies - Change zerolog → slog in Go styleguide - Fix JS styleguide npm reference: both work, but use make targets - Drop .json from healthcheck path, add JSON content-type requirement - Add Author/License to Go HTTP Server Conventions - Convert hyperlinks to backtick URLs in checklists for consistency - Add version/front matter to both checklists
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
Version: 2026-02-22
|
||||
|
||||
# Golang
|
||||
---
|
||||
title: Code Styleguide — Go
|
||||
last_modified: 2026-02-22
|
||||
---
|
||||
|
||||
1. Try to hard wrap long lines at 77 characters or less.
|
||||
|
||||
@@ -70,11 +71,8 @@ Version: 2026-02-22
|
||||
1. Avoid obvious footguns. For example, use range instead of for loops for
|
||||
iterating.
|
||||
|
||||
1. Try to use zerolog for logging. It's fast and has a nice API. For
|
||||
smaller/quick projects, the standard library's `log` package (and
|
||||
specifically `log/slog`) is fine. In that case, log structured logs whenever
|
||||
possible, and import `sneak.berlin/go/simplelog` to configure it
|
||||
appropriately. Example:
|
||||
1. Use `log/slog` for structured logging. Import `sneak.berlin/go/simplelog`
|
||||
for sensible defaults. Example:
|
||||
|
||||
```go
|
||||
package main
|
||||
@@ -107,9 +105,9 @@ Version: 2026-02-22
|
||||
able-to-be-compiled state, linted, and any tests run. The Docker build
|
||||
should fail if linting doesn't pass.
|
||||
|
||||
1. Include a `Makefile` with targets for at least `clean` and `test`. If there
|
||||
are multiple binaries, include a target for each binary. If there are
|
||||
multiple binaries, include a target for `all` that builds all binaries.
|
||||
1. Every repo must have a `Makefile`. See
|
||||
[Repository Policies](https://git.eeqj.de/sneak/prompts/raw/branch/main/prompts/REPO_POLICIES.md)
|
||||
for required targets and conventions.
|
||||
|
||||
1. If you are writing a single-module library, `.go` files are okay in the repo
|
||||
root.
|
||||
@@ -132,7 +130,7 @@ Version: 2026-02-22
|
||||
single-file scripts.
|
||||
|
||||
1. HTTP HandleFuncs should be returned from methods or functions that need to
|
||||
handle HTTP requests. Don't use methods or our top level functions as
|
||||
handle HTTP requests. Don't use methods or your top level functions as
|
||||
handlers.
|
||||
|
||||
1. Provide a .gitignore file that ignores at least `*.log`, `*.out`, and
|
||||
@@ -431,7 +429,7 @@ Version: 2026-02-22
|
||||
releasable". "Releasable" in this context means that it builds and functions
|
||||
as expected, and that all tests and linting passes.
|
||||
|
||||
## Other Golang Tips and Best Practices (Optional)
|
||||
# Other Golang Tips and Best Practices (Optional)
|
||||
|
||||
1. For any internet-facing http server, set appropriate timeouts and limits to
|
||||
protect against slowloris attacks or huge uploads that can consume server
|
||||
|
||||
Reference in New Issue
Block a user