mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
net,os: use os.LookupEnv instead of syscall.Getenv
Change-Id: I3caf7cbf10bfb058b04eb2ace009c1dd76196d05
This commit is contained in:
parent
eb6f2c24cd
commit
bc5f30bf56
2 changed files with 2 additions and 4 deletions
|
|
@ -13,7 +13,6 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
"sync"
|
"sync"
|
||||||
"syscall"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// The net package's name resolution is rather complicated.
|
// The net package's name resolution is rather complicated.
|
||||||
|
|
@ -138,7 +137,7 @@ func initConfVal() {
|
||||||
// prefer the cgo resolver.
|
// prefer the cgo resolver.
|
||||||
// Note that LOCALDOMAIN can change behavior merely by being
|
// Note that LOCALDOMAIN can change behavior merely by being
|
||||||
// specified with the empty string.
|
// specified with the empty string.
|
||||||
_, localDomainDefined := syscall.Getenv("LOCALDOMAIN")
|
_, localDomainDefined := os.LookupEnv("LOCALDOMAIN")
|
||||||
if localDomainDefined || os.Getenv("RES_OPTIONS") != "" || os.Getenv("HOSTALIASES") != "" {
|
if localDomainDefined || os.Getenv("RES_OPTIONS") != "" || os.Getenv("HOSTALIASES") != "" {
|
||||||
confVal.preferCgo = true
|
confVal.preferCgo = true
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ErrNotFound is the error resulting if a path search failed to find an executable file.
|
// 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
|
dotf string
|
||||||
dotErr error
|
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 f, err := findExecutable(filepath.Join(".", file), exts); err == nil {
|
||||||
if execerrdot.Value() == "0" {
|
if execerrdot.Value() == "0" {
|
||||||
execerrdot.IncNonDefault()
|
execerrdot.IncNonDefault()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue