mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 13:18:53 +00:00
all: use syncs.AtomicValue
Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
@@ -9,7 +9,8 @@ import (
|
||||
"os"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"sync/atomic"
|
||||
|
||||
"tailscale.com/syncs"
|
||||
)
|
||||
|
||||
type Distro string
|
||||
@@ -28,14 +29,14 @@ const (
|
||||
WDMyCloud = Distro("wdmycloud")
|
||||
)
|
||||
|
||||
var distroAtomic atomic.Value // of Distro
|
||||
var distroAtomic syncs.AtomicValue[Distro]
|
||||
|
||||
// Get returns the current distro, or the empty string if unknown.
|
||||
func Get() Distro {
|
||||
d, ok := distroAtomic.Load().(Distro)
|
||||
if ok {
|
||||
if d, ok := distroAtomic.LoadOk(); ok {
|
||||
return d
|
||||
}
|
||||
var d Distro
|
||||
switch runtime.GOOS {
|
||||
case "linux":
|
||||
d = linuxDistro()
|
||||
|
Reference in New Issue
Block a user