"errors"
"fmt"
"io"
+ "io/fs"
"log"
"os"
"path"
- "path/filepath"
"strings"
"golang.org/x/sys/unix"
FileExistsCache[p] = true
return true
}
- if os.IsNotExist(err) {
+ if errors.Is(err, fs.ErrNotExist) {
FileExistsCache[p] = false
}
return false
return fmt.Sprintf("%s: %s", e.Tgt, e.Err)
}
-func cwdMustRel(paths ...string) string {
- rel, err := filepath.Rel(Cwd, path.Join(paths...))
- if err != nil {
- panic(err)
- }
- return rel
-}
-
-func cwdAndTgt(tgt string) (string, string) {
- cwd, tgt := path.Split(tgt)
- cwd, err := filepath.Abs(cwd)
- if err != nil {
- panic(err)
- }
- return cwd, tgt
-}
-
func isSrc(cwd, tgt string) bool {
d, f := path.Split(path.Join(cwd, tgt))
if !FileExists(path.Join(d, f)) {
inode, err := inodeFromFileByPath(path.Join(cwd, dep))
if err != nil {
- if os.IsNotExist(err) {
+ if errors.Is(err, fs.ErrNotExist) {
tracef(CDebug, "ood: %s%s -> %s: not exists", indent, tgtOrig, dep)
ood = true
OODCache[path.Join(cwd, dep)] = ood
level int,
seen map[string]struct{},
) (bool, error) {
- p, err := filepath.Abs(path.Join(cwd, tgtOrig))
- if err != nil {
- panic(err)
- }
+ p := mustAbs(path.Join(cwd, tgtOrig))
_, ood := OODTgts[p]
+ var err error
if ood {
if !isOODByBuildUUID(cwd, tgtOrig) {
tracef(