Why this matters
Using a pointer to a slice or map is redundant and can make snippet harder to understand. Since slices and maps already have reference semantics, passing them directly is simpler and less error-prone.
Do not use pointers to slice or map types. Slices and maps are already reference types that point to underlying data, so they can be passed by value and still allow modifications to the contents.
Using a pointer to a slice or map is redundant and can make snippet harder to understand. Since slices and maps already have reference semantics, passing them directly is simpler and less error-prone.
Side-by-side examples engineers can pattern-match during review.
func AddItem(list *[]string, item string) {
*list = append(*list, item) // using a pointer to a slice
}func AddItem(list []string, item string) []string {
return append(list, item) // pass slice by value and return the new slice
}func AddItem(list *[]string, item string) {
*list = append(*list, item) // using a pointer to a slice
}func AddItem(list []string, item string) []string {
return append(list, item) // pass slice by value and return the new slice
}From the same buckets as this rule.
All static JS/CSS/font/image files MUST use content-hashed filenames (e.g., app.9c1a7b.js) and be served with "Cache-Control: public, max-age=31536000, immutable". HTML and other non-fingerprinted documents MUST be served with "Cache-Control: no-cache" (or equivalent) to enable conditional revalidation.