Wrap errors to add context as they bubble up:
data, err := readFile("config.json")
if err != nil {
return fmt.Errorf("loading config: %w", err)
}
The %w verb wraps the original error. The result contains both your message and the original error. This builds a chain of context.