diff --git a/pkg/console/accessibility.go b/pkg/console/accessibility.go index d33cb83eac6..1af08c97958 100644 --- a/pkg/console/accessibility.go +++ b/pkg/console/accessibility.go @@ -13,7 +13,7 @@ import "os" // - Simplify interactive elements // - Use plain text instead of fancy formatting func IsAccessibleMode() bool { - return os.Getenv("ACCESSIBLE") != "" || - os.Getenv("TERM") == "dumb" || - os.Getenv("NO_COLOR") != "" + return os.Getenv("ACCESSIBLE") != "" || //nolint:osgetenvlibrary + os.Getenv("TERM") == "dumb" || //nolint:osgetenvlibrary + os.Getenv("NO_COLOR") != "" //nolint:osgetenvlibrary } diff --git a/pkg/console/spinner.go b/pkg/console/spinner.go index bf77aab63a7..0480c941a2c 100644 --- a/pkg/console/spinner.go +++ b/pkg/console/spinner.go @@ -101,7 +101,7 @@ type SpinnerWrapper struct { // Automatically disabled when not running in a TTY or when ACCESSIBLE env var is set. func NewSpinner(message string) *SpinnerWrapper { isTTY := tty.IsStderrTerminal() - isAccessible := os.Getenv("ACCESSIBLE") != "" + isAccessible := IsAccessibleMode() enabled := isTTY && !isAccessible spinnerLog.Printf("Creating spinner: message=%q, tty=%t, accessible=%t, enabled=%t", message, isTTY, isAccessible, enabled) s := &SpinnerWrapper{enabled: enabled} diff --git a/pkg/constants/constants.go b/pkg/constants/constants.go index 8e28fbf27ba..95c4c4ce5ea 100644 --- a/pkg/constants/constants.go +++ b/pkg/constants/constants.go @@ -548,7 +548,7 @@ const UsrLocalPrefix = "/usr/local" // Always uses forward slashes, which are required for git/GitHub paths. // GH_AW_WORKFLOWS_DIR overrides the default; any OS-specific separators are normalized. func GetWorkflowDir() string { - if dir := os.Getenv("GH_AW_WORKFLOWS_DIR"); dir != "" { + if dir := os.Getenv("GH_AW_WORKFLOWS_DIR"); dir != "" { //nolint:osgetenvlibrary return filepath.ToSlash(dir) } return WorkflowsDir diff --git a/pkg/envutil/envutil.go b/pkg/envutil/envutil.go index c1d28cf9756..50237c1bfcd 100644 --- a/pkg/envutil/envutil.go +++ b/pkg/envutil/envutil.go @@ -36,7 +36,7 @@ func GetIntFromEnv(envVar string, defaultValue, minValue, maxValue int, debugLog } } - envValue := os.Getenv(envVar) + envValue := os.Getenv(envVar) //nolint:osgetenvlibrary if envValue == "" { return defaultValue } diff --git a/pkg/github/label_objective_mapping.go b/pkg/github/label_objective_mapping.go index 589a98dd2ee..3e5fcd8e618 100644 --- a/pkg/github/label_objective_mapping.go +++ b/pkg/github/label_objective_mapping.go @@ -134,7 +134,7 @@ func LoadObjectiveMappingFromConfig() *ObjectiveMapping { labelObjectiveMappingLog.Print("Loading objective mapping configuration") // Try loading from OBJECTIVE_MAPPING_JSON env var - if mappingJSON := os.Getenv("OBJECTIVE_MAPPING_JSON"); mappingJSON != "" { + if mappingJSON := os.Getenv("OBJECTIVE_MAPPING_JSON"); mappingJSON != "" { //nolint:osgetenvlibrary labelObjectiveMappingLog.Print("Attempting to load from OBJECTIVE_MAPPING_JSON env var") var om ObjectiveMapping if err := json.Unmarshal([]byte(mappingJSON), &om); err == nil { diff --git a/pkg/logger/logger.go b/pkg/logger/logger.go index ffa0d0195bb..569a3b09366 100644 --- a/pkg/logger/logger.go +++ b/pkg/logger/logger.go @@ -28,7 +28,7 @@ var ( debugEnv = initDebugEnv() // DEBUG_COLORS environment variable to control color output. - debugColors = os.Getenv("DEBUG_COLORS") != "0" + debugColors = os.Getenv("DEBUG_COLORS") != "0" //nolint:osgetenvlibrary // Color palette for namespace coloring, using adaptive styles. colorPalette = []lipgloss.Style{ @@ -51,10 +51,10 @@ var ( // If DEBUG is set, it takes precedence. Otherwise, if ACTIONS_RUNNER_DEBUG=true, // all loggers are enabled (equivalent to DEBUG=*). func initDebugEnv() string { - if d := os.Getenv("DEBUG"); d != "" { + if d := os.Getenv("DEBUG"); d != "" { //nolint:osgetenvlibrary return d } - if os.Getenv("ACTIONS_RUNNER_DEBUG") == "true" { + if os.Getenv("ACTIONS_RUNNER_DEBUG") == "true" { //nolint:osgetenvlibrary return "*" } return "" diff --git a/pkg/parser/github.go b/pkg/parser/github.go index 80613ed1f01..e82ad0ae45c 100644 --- a/pkg/parser/github.go +++ b/pkg/parser/github.go @@ -29,7 +29,7 @@ func GetGitHubHost() string { envVars := []string{"GITHUB_SERVER_URL", "GITHUB_ENTERPRISE_HOST", "GITHUB_HOST", "GH_HOST"} for _, envVar := range envVars { - if value := os.Getenv(envVar); value != "" { + if value := os.Getenv(envVar); value != "" { //nolint:osgetenvlibrary githubLog.Printf("Resolved GitHub host from %s: %s", envVar, value) return stringutil.NormalizeGitHubHostURL(value) } @@ -62,11 +62,11 @@ func GetGitHubToken() (string, error) { githubLog.Print("Getting GitHub token") // First try environment variable - if token := os.Getenv("GITHUB_TOKEN"); token != "" { + if token := os.Getenv("GITHUB_TOKEN"); token != "" { //nolint:osgetenvlibrary githubLog.Print("Found GITHUB_TOKEN environment variable") return token, nil } - if token := os.Getenv("GH_TOKEN"); token != "" { + if token := os.Getenv("GH_TOKEN"); token != "" { //nolint:osgetenvlibrary githubLog.Print("Found GH_TOKEN environment variable") return token, nil }