b2797dc [release-branch.go1.13] cmd/go: do not append to the global cfg.OrigEnv slice

2 files Authored by Bryan C. Mills 4 years ago, Committed by Andrew Bonventre 4 years ago,
    [release-branch.go1.13] cmd/go: do not append to the global cfg.OrigEnv slice
    
    Appending to a global slice is only safe if its length is already
    equal to its capacity. That property is not guaranteed for slices in
    general, and empirically does not hold for this one.
    
    This is a minimal fix to make it easier to backport.
    A more robust cleanup of the base.EnvForDir function will be sent in a
    subsequent CL.
    
    Fixes #38082
    Updates #38077
    
    Change-Id: I731d5bbd0e516642c2cf43e713eeea15402604e5
    Reviewed-on: https://go-review.googlesource.com/c/go/+/225577
    Run-TryBot: Bryan C. Mills <bcmills@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: Jay Conrod <jayconrod@google.com>
    Reviewed-by: Michael Matloob <matloob@golang.org>
    (cherry picked from commit bfb1342a40216cba0ff5ae3a1b102823b7603068)
    Reviewed-on: https://go-review.googlesource.com/c/go/+/225660