]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/cmd/nncp-xfer/main.go
os.IsNotExists is deprecated
[nncp.git] / src / cmd / nncp-xfer / main.go
index bb74f45cd4482b9f7bb97a0ec8e0cd29a1b79149..8685b1c1c5324633c292e2cbe53b08d21e52f03b 100644 (file)
@@ -24,6 +24,7 @@ import (
        "flag"
        "fmt"
        "io"
+       "io/fs"
        "log"
        "os"
        "path/filepath"
@@ -120,7 +121,7 @@ func main() {
        }
        ctx.LogD("xfer-self", les, logMsg)
        if _, err = os.Stat(selfPath); err != nil {
-               if os.IsNotExist(err) {
+               if errors.Is(err, fs.ErrNotExist) {
                        ctx.LogD("xfer-self-no-dir", les, func(les nncp.LEs) string {
                                return logMsg(les) + ": no directory"
                        })
@@ -215,7 +216,7 @@ func main() {
                                string(nncp.TRx),
                                nncp.SeenDir,
                                fiInt.Name(),
-                       )); err == nil || !os.IsNotExist(err) {
+                       )); err == nil || !errors.Is(err, fs.ErrNotExist) {
                                ctx.LogI("xfer-rx-seen", les, func(les nncp.LEs) string {
                                        return logMsg(les) + ": packet already seen"
                                })
@@ -389,7 +390,7 @@ Tx:
                }
                _, err = os.Stat(nodePath)
                if err != nil {
-                       if os.IsNotExist(err) {
+                       if errors.Is(err, fs.ErrNotExist) {
                                ctx.LogD("xfer-tx-not-exist", les, func(les nncp.LEs) string {
                                        return logMsg(les) + ": does not exist"
                                })
@@ -420,7 +421,7 @@ Tx:
                }
                _, err = os.Stat(dstPath)
                if err != nil {
-                       if os.IsNotExist(err) {
+                       if errors.Is(err, fs.ErrNotExist) {
                                if err = os.Mkdir(dstPath, os.FileMode(0777)); err != nil {
                                        ctx.UnlockDir(dirLock)
                                        ctx.LogE("xfer-tx-mkdir", les, err, logMsg)
@@ -450,7 +451,7 @@ Tx:
                                })
                                continue
                        }
-                       if _, err = os.Stat(filepath.Join(dstPath, pktName)); err == nil || !os.IsNotExist(err) {
+                       if _, err = os.Stat(filepath.Join(dstPath, pktName)); err == nil || !errors.Is(err, fs.ErrNotExist) {
                                ctx.LogD("xfer-tx-exists", les, func(les nncp.LEs) string {
                                        return logMsg(les) + ": already exists"
                                })