diff --git a/net/dns/wsl_windows.go b/net/dns/wsl_windows.go index 9706af04a..c846c2ffa 100644 --- a/net/dns/wsl_windows.go +++ b/net/dns/wsl_windows.go @@ -6,6 +6,7 @@ import ( "bytes" + "errors" "fmt" "os" "os/exec" @@ -193,7 +194,8 @@ func (fs wslFS) Truncate(name string) error { return fs.WriteFile(name, nil, 064 func (fs wslFS) ReadFile(name string) ([]byte, error) { b, err := wslCombinedOutput(fs.cmd("cat", "--", name)) - if ee, _ := err.(*exec.ExitError); ee != nil && ee.ExitCode() == 1 { + var ee *exec.ExitError + if errors.As(err, &ee) && ee.ExitCode() == 1 { return nil, os.ErrNotExist } return b, err