From 608454994b73c6d797158772e72fb263eb6d63c6 Mon Sep 17 00:00:00 2001 From: Jordan Stephens Date: Mon, 19 Jan 2026 10:09:49 -0800 Subject: [PATCH 1/2] avoid printing env vars conflict warnings if there is no conflict --- src/pkg/stacks/stacks.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/pkg/stacks/stacks.go b/src/pkg/stacks/stacks.go index 8a2b1e5b5..84781e291 100644 --- a/src/pkg/stacks/stacks.go +++ b/src/pkg/stacks/stacks.go @@ -216,19 +216,21 @@ func ReadInDirectory(workingDirectory, name string) (*Parameters, error) { // This was basically ripped out of godotenv.Overload/Load. Unfortunately, they don't export // a function that loads a map[string]string, so we have to reimplement it here. func LoadStackEnv(params Parameters, overload bool) error { - currentEnv := map[string]bool{} + currentEnv := map[string]string{} rawEnv := os.Environ() for _, rawEnvLine := range rawEnv { - key := strings.Split(rawEnvLine, "=")[0] - currentEnv[key] = true + key, value, found := strings.Cut(rawEnvLine, "=") + if found { + currentEnv[key] = value + } } paramsMap := params.ToMap() for key, value := range paramsMap { - if currentEnv[key] && !overload { - term.Warnf("The variable %q is set in both the stack file and the environment. The value from the environment will be used.\n", key) + if currentEnv[key] != value && !overload { + term.Warnf("The variable %q is set in both the stack and the environment. The value from the environment will be used.\n", key) } - if !currentEnv[key] || overload { + if _, ok := currentEnv[key]; !ok || overload { err := os.Setenv(key, value) if err != nil { return fmt.Errorf("could not set env var %q: %w", key, err) From 0bae8bc79bd362618e3123b5a24d1946052ef772 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lio=E6=9D=8E=E6=AD=90?= Date: Mon, 19 Jan 2026 13:43:26 -0800 Subject: [PATCH 2/2] fix false positives on missing envs --- src/pkg/stacks/stacks.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pkg/stacks/stacks.go b/src/pkg/stacks/stacks.go index 84781e291..b00218f7e 100644 --- a/src/pkg/stacks/stacks.go +++ b/src/pkg/stacks/stacks.go @@ -227,7 +227,7 @@ func LoadStackEnv(params Parameters, overload bool) error { paramsMap := params.ToMap() for key, value := range paramsMap { - if currentEnv[key] != value && !overload { + if envValue, ok := currentEnv[key]; ok && envValue != value && !overload { term.Warnf("The variable %q is set in both the stack and the environment. The value from the environment will be used.\n", key) } if _, ok := currentEnv[key]; !ok || overload {