diff --git a/compileopts/target_test.go b/compileopts/target_test.go index 8f7b99b2..579c54f6 100644 --- a/compileopts/target_test.go +++ b/compileopts/target_test.go @@ -1,7 +1,8 @@ package compileopts import ( - "os" + "errors" + "io/fs" "reflect" "testing" ) @@ -17,7 +18,7 @@ func TestLoadTarget(t *testing.T) { t.Error("LoadTarget should have failed with non existing target") } - if !os.IsNotExist(err) { + if !errors.Is(err, fs.ErrNotExist) { t.Error("LoadTarget failed for wrong reason:", err) } } diff --git a/src/testing/testing_test.go b/src/testing/testing_test.go index 91816b63..3ab32426 100644 --- a/src/testing/testing_test.go +++ b/src/testing/testing_test.go @@ -10,6 +10,8 @@ package testing_test import ( + "errors" + "io/fs" "os" "path/filepath" "testing" @@ -42,7 +44,7 @@ func TestTempDirInCleanup(t *testing.T) { if fi != nil { t.Fatalf("Directory %q from user Cleanup still exists", dir) } - if !os.IsNotExist(err) { + if !errors.Is(err, fs.ErrNotExist) { t.Fatalf("Unexpected error: %v", err) } } @@ -85,7 +87,7 @@ func testTempDir(t *testing.T) { select { case dir := <-dirCh: fi, err := os.Stat(dir) - if os.IsNotExist(err) { + if errors.Is(err, fs.ErrNotExist) { // All good return }