envknob_testable.go 583 B

1234567891011121314151617181920212223
  1. // Copyright (c) Tailscale Inc & AUTHORS
  2. // SPDX-License-Identifier: BSD-3-Clause
  3. //go:build !ts_not_in_tests
  4. package envknob
  5. import "runtime"
  6. // GOOS reports the effective runtime.GOOS to run as.
  7. //
  8. // In practice this returns just runtime.GOOS, unless overridden by
  9. // test TS_DEBUG_FAKE_GOOS.
  10. //
  11. // This allows changing OS-specific stuff like the IPN server behavior
  12. // for tests so we can e.g. test Windows-specific behaviors on Linux.
  13. // This isn't universally used.
  14. func GOOS() string {
  15. if v := String("TS_DEBUG_FAKE_GOOS"); v != "" {
  16. return v
  17. }
  18. return runtime.GOOS
  19. }