envknob: add GOOS func

Centralize the fake GOOS stuff, start to use it more. To be used more
in the future.

Change-Id: Iabacfbeaf5fca0b53bf4d5dbcdc0367f05a205f9
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2022-11-23 15:40:47 -08:00
committed by Brad Fitzpatrick
parent 6e6f27dd21
commit 4d3713f631
6 changed files with 45 additions and 10 deletions

View File

@@ -13,6 +13,7 @@ import (
"time"
"golang.org/x/exp/slices"
"tailscale.com/envknob"
"tailscale.com/ipn"
"tailscale.com/tailcfg"
"tailscale.com/types/logger"
@@ -423,7 +424,7 @@ func ReadStartupPrefsForTest(logf logger.Logf, store ipn.StateStore) (ipn.PrefsV
// It also loads the list of known profiles from the StateStore.
// If a state key is provided, it will be used to load the current profile.
func newProfileManager(store ipn.StateStore, logf logger.Logf, stateKey ipn.StateKey) (*profileManager, error) {
return newProfileManagerWithGOOS(store, logf, stateKey, runtime.GOOS)
return newProfileManagerWithGOOS(store, logf, stateKey, envknob.GOOS())
}
func readAutoStartKey(store ipn.StateStore, goos string) (ipn.StateKey, error) {