Ensure environment dependencies are correct

Store the os Environment on init, then clear it so that it's only
available via a call to Config.Getenv(). That way we're guaranteed to
know about all dependencies.

Test: Add some os.Getenv/Config.Getenv calls and ensure correct behavior
Test: cs/ shows no os.Getenv / os.LookupEnv / os.ExpandEnv calls that
would be affected
Change-Id: Ic519e0c871f340e752df03b8af0599d47c1d91d8
This commit is contained in:
Dan Willemsen
2017-05-05 23:01:54 -07:00
parent 528d5e5d28
commit e78473c33c
2 changed files with 17 additions and 1 deletions

View File

@@ -289,7 +289,7 @@ func (c *config) Getenv(key string) string {
if c.envFrozen {
panic("Cannot access new environment variables after envdeps are frozen")
}
val = os.Getenv(key)
val, _ = originalEnv[key]
c.envDeps[key] = val
}
return val