Skip to content

Commit

Permalink
Merge pull request #73 from Rican7/chore/modern-go
Browse files Browse the repository at this point in the history
Update build tags and error checking to Go 1.18 standards
  • Loading branch information
adrg committed Mar 21, 2024
2 parents 4e30025 + 4f22cb2 commit 490abf7
Show file tree
Hide file tree
Showing 11 changed files with 9 additions and 12 deletions.
4 changes: 3 additions & 1 deletion internal/pathutil/pathutil_plan9.go
@@ -1,6 +1,8 @@
package pathutil

import (
"errors"
"io/fs"
"os"
"path/filepath"
"strings"
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion internal/pathutil/pathutil_plan9_test.go
@@ -1,5 +1,4 @@
//go:build plan9
// +build plan9

package pathutil_test

Expand Down
5 changes: 3 additions & 2 deletions 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"
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion 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

Expand Down
4 changes: 3 additions & 1 deletion internal/pathutil/pathutil_windows.go
@@ -1,6 +1,8 @@
package pathutil

import (
"errors"
"io/fs"
"os"
"path/filepath"
"strings"
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion internal/pathutil/pathutil_windows_test.go
@@ -1,5 +1,4 @@
//go:build windows
// +build windows

package pathutil_test

Expand Down
1 change: 0 additions & 1 deletion paths_darwin_test.go
@@ -1,5 +1,4 @@
//go:build darwin
// +build darwin

package xdg_test

Expand Down
1 change: 0 additions & 1 deletion paths_plan9_test.go
@@ -1,5 +1,4 @@
//go:build plan9
// +build plan9

package xdg_test

Expand Down
1 change: 0 additions & 1 deletion 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

Expand Down
1 change: 0 additions & 1 deletion 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

Expand Down
1 change: 0 additions & 1 deletion paths_windows_test.go
@@ -1,5 +1,4 @@
//go:build windows
// +build windows

package xdg_test

Expand Down

0 comments on commit 490abf7

Please sign in to comment.