Replace utils.Once with stdlib sync.OnceValue

This commit is contained in:
Kovid Goyal
2023-08-09 12:08:42 +05:30
parent 49ea26968c
commit 4f72bb9894
22 changed files with 53 additions and 96 deletions

View File

@@ -7,13 +7,14 @@ import (
"os"
"path/filepath"
"strings"
"sync"
"golang.org/x/sys/unix"
)
var _ = fmt.Print
var DefaultExeSearchPaths = Once(func() []string {
var DefaultExeSearchPaths = sync.OnceValue(func() []string {
candidates := [...]string{"/usr/local/bin", "/opt/bin", "/opt/homebrew/bin", "/usr/bin", "/bin", "/usr/sbin", "/sbin"}
ans := make([]string, 0, len(candidates))
for _, x := range candidates {