Fix variable shadowing in author detection

This commit is contained in:
Steve Yegge
2025-10-27 22:30:20 -07:00
parent 9dcfa88711
commit c69d4b4adb

View File

@@ -130,17 +130,17 @@ Examples:
// Get author from author flag, BD_ACTOR var, or system USER var // Get author from author flag, BD_ACTOR var, or system USER var
author, _ := cmd.Flags().GetString("author") author, _ := cmd.Flags().GetString("author")
if author == "" { if author == "" {
author := os.Getenv("BD_ACTOR") author = os.Getenv("BD_ACTOR")
if author == "" { if author == "" {
author = os.Getenv("USER") author = os.Getenv("USER")
} }
if author == "" { if author == "" {
if u, err := user.Current(); err == nil { if u, err := user.Current(); err == nil {
author = u.Username author = u.Username
} else { } else {
author = "unknown" author = "unknown"
} }
} }
} }
var comment *types.Comment var comment *types.Comment