- Add guidance on using field tags in marshaled structs.
- Add guidance on use of
%w
vs%v
withfmt.Errorf
, and where to useerrors.New
or custom error types.
- Add soft line length limit of 99 characters.
- Programs should exit only in
main()
, preferably at most once.
- Add guidance on omitting zero-value fields during struct initialization.
- Add guidance on
Foo{}
versusvar
form for initialization of empty structs. - Add new section for Initializing Structs, moving relevant guidances into subsections of it.
- Add guidance on avoiding
init()
. - Add guidance to avoid using built-in names.
- Add reminder that nil slices are not always the same as empty slices.
- Add guidance on verifying interface compliance with compile-time checks.
- Recommend using the
time
package when dealing with time.
- Add guidance against embedding types in public structs.
- Functional Options: Recommend struct implementations of
Option
interface instead of capturing values with a closure.
- Add guidance against mutating global variables.
- Add section on remaining consistent with existing practices.
- Add guidance on map initialization and size hints.
- Suggest succinct context for error messages.
- Initial release.