Go Strict Standard
Rules extracted from 2 production Go services.
CRITICAL: Error Handling
GO-01: Always wrap errors with context
// BAD: no context, impossible to trace
if err != nil {
return err
}
// GOOD: fmt.Errorf with %w for wrapping
store, err := createStore(path)
if err != nil {
return nil, fmt.Errorf("create store: %w", err)
}
// GOOD: multiple levels of context
session, err := validateToken(token)
if err != nil {
return fmt.Errorf("validate session for
[Description truncada. Veja o README completo no GitHub.]