diff --git a/src/net/conf_test.go b/src/net/conf_test.go index d0d450aa8a..3736709295 100644 --- a/src/net/conf_test.go +++ b/src/net/conf_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || aix +//go:build unix package net diff --git a/src/net/dnsclient_unix_test.go b/src/net/dnsclient_unix_test.go index 81117b8c75..83ce7b28e9 100644 --- a/src/net/dnsclient_unix_test.go +++ b/src/net/dnsclient_unix_test.go @@ -10,7 +10,6 @@ import ( "context" "errors" "fmt" - "io/fs" "os" "path" "path/filepath" @@ -2531,7 +2530,7 @@ func TestLookupOrderFilesNoSuchHost(t *testing.T) { if runtime.GOOS == "openbsd" { // Set error to ErrNotExist, so that the hostLookupOrder // returns hostLookupFiles for openbsd. - resolvConf.err = fs.ErrNotExist + resolvConf.err = os.ErrNotExist } if !conf.forceUpdateConf(&resolvConf, time.Now().Add(time.Hour)) { @@ -2539,12 +2538,9 @@ func TestLookupOrderFilesNoSuchHost(t *testing.T) { } tmpFile := filepath.Join(t.TempDir(), "hosts") - f, err := os.OpenFile(tmpFile, os.O_CREATE|os.O_WRONLY, 0660) - if err != nil { + if err := os.WriteFile(tmpFile, []byte{}, 0660); err != nil { t.Fatal(err) } - defer f.Close() - testHookHostsPath = tmpFile const testName = "test.invalid"