]> Cypherpunks repositories - gostls13.git/commit
os/exec: preserve original order of entries in dedupEnv
authorBryan C. Mills <bcmills@google.com>
Tue, 19 Apr 2022 19:54:50 +0000 (15:54 -0400)
committerGopher Robot <gobot@golang.org>
Thu, 21 Apr 2022 14:26:18 +0000 (14:26 +0000)
commitaa242555412c29f8af3da7d92067577c6b089c3a
treed250c8d451a627ec09f3834de81ccf4f8d69c0be
parentab9d31da9e088a271e656120a3d99cd3b1103ab6
os/exec: preserve original order of entries in dedupEnv

Once #50599 is implemented, the entries will be observable via the
Environ method. I find it confusing for later entries in the list to
jump arbitrarily far forward based on entries for the same key that no
longer exist.

This also fixes the deduplication logic for the degenerate Windows
keys observed in #49886, which were previously deduplicated as empty
keys.

(It does not do anything about the even-more-degenerate keys observed
in #52436.)

For #50599.

Change-Id: Ia7cd2200ec34ccc4b9d18631cb513194dc420c25
Reviewed-on: https://go-review.googlesource.com/c/go/+/401339
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/os/exec/env_test.go
src/os/exec/exec.go