fix(env): remove defer on platform

This is a small fix to actually store the value. Arguments to defers are apparently
evaluated immediately so put it in an anonymous function.
This commit is contained in:
Michael Guntsche 2022-01-18 22:40:50 +01:00 committed by Jan De Dobbeleer
parent ad297dbe08
commit de60367d79

View file

@ -58,7 +58,9 @@ func (env *environment) getPlatform() string {
return val
}
var platform string
defer env.cache().set(key, platform, -1)
defer func() {
env.cache().set(key, platform, -1)
}()
if wsl := env.getenv("WSL_DISTRO_NAME"); len(wsl) != 0 {
platform = strings.ToLower(wsl)
return platform