]> Cypherpunks repositories - gostls13.git/commitdiff
net,os: use os.LookupEnv instead of syscall.Getenv
authorMateusz Poliwczak <mpoliwczak34@gmail.com>
Sat, 28 Sep 2024 16:20:58 +0000 (16:20 +0000)
committerGopher Robot <gobot@golang.org>
Mon, 30 Sep 2024 12:38:46 +0000 (12:38 +0000)
The os package already has a function for retrieving an environment
variable with a ok boolean, we don't need to use syscall directly.

Change-Id: Ife873e7245261ec765b628e31a0e7a7bc4dff934
GitHub-Last-Rev: bc5f30bf56c87a94e0f17dd67a15aa4b2d7e3fd4
GitHub-Pull-Request: golang/go#69700
Reviewed-on: https://go-review.googlesource.com/c/go/+/616342
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
src/net/conf.go
src/os/exec/lp_windows.go

index 358f5434c4de364ea78ecd9e019a67c8719fda99..1b48546f1bd89348b5042f7d321e7bc2c261f9d1 100644 (file)
@@ -13,7 +13,6 @@ import (
        "os"
        "runtime"
        "sync"
-       "syscall"
 )
 
 // The net package's name resolution is rather complicated.
@@ -138,7 +137,7 @@ func initConfVal() {
        // prefer the cgo resolver.
        // Note that LOCALDOMAIN can change behavior merely by being
        // specified with the empty string.
-       _, localDomainDefined := syscall.Getenv("LOCALDOMAIN")
+       _, localDomainDefined := os.LookupEnv("LOCALDOMAIN")
        if localDomainDefined || os.Getenv("RES_OPTIONS") != "" || os.Getenv("HOSTALIASES") != "" {
                confVal.preferCgo = true
                return
index 0e058d41b0c11f3a01172bb7c960a15b1a09e3be..1225674306458509ae694a9612e109dcd1730ae6 100644 (file)
@@ -10,7 +10,6 @@ import (
        "os"
        "path/filepath"
        "strings"
-       "syscall"
 )
 
 // ErrNotFound is the error resulting if a path search failed to find an executable file.
@@ -154,7 +153,7 @@ func lookPath(file string, exts []string) (string, error) {
                dotf   string
                dotErr error
        )
-       if _, found := syscall.Getenv("NoDefaultCurrentDirectoryInExePath"); !found {
+       if _, found := os.LookupEnv("NoDefaultCurrentDirectoryInExePath"); !found {
                if f, err := findExecutable(filepath.Join(".", file), exts); err == nil {
                        if execerrdot.Value() == "0" {
                                execerrdot.IncNonDefault()