util/uniq,types/lazy,*: delete code that's now in Go std
sync.OnceValue and slices.Compact were both added in Go 1.21. cmp.Or was added in Go 1.22. Updates #8632 Updates #11058 Change-Id: I89ba4c404f40188e1f8a9566c8aaa049be377754 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
5fdb4f83ad
commit
69b90742fe
+2
-3
@@ -7,11 +7,10 @@ import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"tailscale.com/types/lazy"
|
||||
"sync"
|
||||
)
|
||||
|
||||
var stringLazy = lazy.SyncFunc(func() string {
|
||||
var stringLazy = sync.OnceValue(func() string {
|
||||
var ret strings.Builder
|
||||
ret.WriteString(Short())
|
||||
ret.WriteByte('\n')
|
||||
|
||||
+2
-1
@@ -9,6 +9,7 @@ import (
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"tailscale.com/tailcfg"
|
||||
"tailscale.com/types/lazy"
|
||||
@@ -174,7 +175,7 @@ func IsUnstableBuild() bool {
|
||||
})
|
||||
}
|
||||
|
||||
var isDev = lazy.SyncFunc(func() bool {
|
||||
var isDev = sync.OnceValue(func() bool {
|
||||
return strings.Contains(Short(), "-dev")
|
||||
})
|
||||
|
||||
|
||||
+2
-1
@@ -9,6 +9,7 @@ import (
|
||||
"runtime/debug"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
tailscaleroot "tailscale.com"
|
||||
"tailscale.com/types/lazy"
|
||||
@@ -117,7 +118,7 @@ func (i embeddedInfo) commitAbbrev() string {
|
||||
return i.commit
|
||||
}
|
||||
|
||||
var getEmbeddedInfo = lazy.SyncFunc(func() embeddedInfo {
|
||||
var getEmbeddedInfo = sync.OnceValue(func() embeddedInfo {
|
||||
bi, ok := debug.ReadBuildInfo()
|
||||
if !ok {
|
||||
return embeddedInfo{}
|
||||
|
||||
Reference in New Issue
Block a user