diff --git a/internal/pathutil/pathutil_plan9.go b/internal/pathutil/pathutil_plan9.go index 8ee4e8d..389a0b6 100644 --- a/internal/pathutil/pathutil_plan9.go +++ b/internal/pathutil/pathutil_plan9.go @@ -1,6 +1,8 @@ package pathutil import ( + "errors" + "io/fs" "os" "path/filepath" "strings" @@ -9,7 +11,7 @@ import ( // Exists returns true if the specified path exists. func Exists(path string) bool { _, err := os.Stat(path) - return err == nil || os.IsExist(err) + return err == nil || errors.Is(err, fs.ErrExist) } // ExpandHome substitutes `~` and `$home` at the start of the specified diff --git a/internal/pathutil/pathutil_plan9_test.go b/internal/pathutil/pathutil_plan9_test.go index 4e77d18..8c09794 100644 --- a/internal/pathutil/pathutil_plan9_test.go +++ b/internal/pathutil/pathutil_plan9_test.go @@ -1,5 +1,4 @@ //go:build plan9 -// +build plan9 package pathutil_test diff --git a/internal/pathutil/pathutil_unix.go b/internal/pathutil/pathutil_unix.go index a014c66..be5b802 100644 --- a/internal/pathutil/pathutil_unix.go +++ b/internal/pathutil/pathutil_unix.go @@ -1,9 +1,10 @@ //go:build aix || darwin || dragonfly || freebsd || (js && wasm) || nacl || linux || netbsd || openbsd || solaris -// +build aix darwin dragonfly freebsd js,wasm nacl linux netbsd openbsd solaris package pathutil import ( + "errors" + "io/fs" "os" "path/filepath" "strings" @@ -12,7 +13,7 @@ import ( // Exists returns true if the specified path exists. func Exists(path string) bool { _, err := os.Stat(path) - return err == nil || os.IsExist(err) + return err == nil || errors.Is(err, fs.ErrExist) } // ExpandHome substitutes `~` and `$HOME` at the start of the specified diff --git a/internal/pathutil/pathutil_unix_test.go b/internal/pathutil/pathutil_unix_test.go index 5fe1c13..fd1d0c2 100644 --- a/internal/pathutil/pathutil_unix_test.go +++ b/internal/pathutil/pathutil_unix_test.go @@ -1,5 +1,4 @@ //go:build aix || darwin || dragonfly || freebsd || (js && wasm) || nacl || linux || netbsd || openbsd || solaris -// +build aix darwin dragonfly freebsd js,wasm nacl linux netbsd openbsd solaris package pathutil_test diff --git a/internal/pathutil/pathutil_windows.go b/internal/pathutil/pathutil_windows.go index 44080e3..c29a223 100644 --- a/internal/pathutil/pathutil_windows.go +++ b/internal/pathutil/pathutil_windows.go @@ -1,6 +1,8 @@ package pathutil import ( + "errors" + "io/fs" "os" "path/filepath" "strings" @@ -15,7 +17,7 @@ func Exists(path string) bool { _, err = filepath.EvalSymlinks(path) } - return err == nil || os.IsExist(err) + return err == nil || errors.Is(err, fs.ErrExist) } // ExpandHome substitutes `%USERPROFILE%` at the start of the specified diff --git a/internal/pathutil/pathutil_windows_test.go b/internal/pathutil/pathutil_windows_test.go index 184a4e7..08a8f65 100644 --- a/internal/pathutil/pathutil_windows_test.go +++ b/internal/pathutil/pathutil_windows_test.go @@ -1,5 +1,4 @@ //go:build windows -// +build windows package pathutil_test diff --git a/paths_darwin_test.go b/paths_darwin_test.go index 5b46e9e..13af1bd 100644 --- a/paths_darwin_test.go +++ b/paths_darwin_test.go @@ -1,5 +1,4 @@ //go:build darwin -// +build darwin package xdg_test diff --git a/paths_plan9_test.go b/paths_plan9_test.go index 06abbe8..9fff760 100644 --- a/paths_plan9_test.go +++ b/paths_plan9_test.go @@ -1,5 +1,4 @@ //go:build plan9 -// +build plan9 package xdg_test diff --git a/paths_unix.go b/paths_unix.go index ad571df..8af2705 100644 --- a/paths_unix.go +++ b/paths_unix.go @@ -1,5 +1,4 @@ //go:build aix || dragonfly || freebsd || (js && wasm) || nacl || linux || netbsd || openbsd || solaris -// +build aix dragonfly freebsd js,wasm nacl linux netbsd openbsd solaris package xdg diff --git a/paths_unix_test.go b/paths_unix_test.go index 055a79f..f0d21ad 100644 --- a/paths_unix_test.go +++ b/paths_unix_test.go @@ -1,5 +1,4 @@ //go:build aix || dragonfly || freebsd || (js && wasm) || nacl || linux || netbsd || openbsd || solaris -// +build aix dragonfly freebsd js,wasm nacl linux netbsd openbsd solaris package xdg_test diff --git a/paths_windows_test.go b/paths_windows_test.go index 48f6261..8407686 100644 --- a/paths_windows_test.go +++ b/paths_windows_test.go @@ -1,5 +1,4 @@ //go:build windows -// +build windows package xdg_test