Use the log package to record errors:
if err != nil {
log.Printf("failed to load config: %v", err)
return err
}
Log before returning so you capture context. Use %v or %+v for errors. In production, consider structured logging with additional context.