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:
@@ -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
|
||||
|
Reference in New Issue
Block a user