diff --git a/cmd/git-remote-ipld/ipld.go b/cmd/git-remote-ipld/ipld.go index 1bf3c14..c4553e3 100644 --- a/cmd/git-remote-ipld/ipld.go +++ b/cmd/git-remote-ipld/ipld.go @@ -4,7 +4,7 @@ import ( "bytes" "errors" "fmt" - "io/ioutil" + "io" "path" "strings" @@ -82,7 +82,7 @@ func (h *IpnsHandler) ProvideBlock(cid string, tracker *core.Tracker) ([]byte, e return nil, errors.New("cat error") } - data, err := ioutil.ReadAll(r) + data, err := io.ReadAll(r) if err != nil { return nil, err } diff --git a/cmd/git-remote-ipld/ipld_test.go b/cmd/git-remote-ipld/ipld_test.go index 217053b..e3c22ae 100644 --- a/cmd/git-remote-ipld/ipld_test.go +++ b/cmd/git-remote-ipld/ipld_test.go @@ -8,7 +8,6 @@ package main import ( "bytes" "io" - "io/ioutil" "log" "os" "path/filepath" @@ -88,7 +87,7 @@ func setupTest(t *testing.T) string { t.Fatal("source is not a directory") } - tmpdir, err := ioutil.TempDir("", "git-test") + tmpdir, err := os.MkdirTemp("", "git-test") if err != nil { t.Fatal(err) } diff --git a/core/fetch.go b/core/fetch.go index a034205..342ed62 100644 --- a/core/fetch.go +++ b/core/fetch.go @@ -4,7 +4,6 @@ import ( "encoding/hex" "errors" "fmt" - "io/ioutil" "log" "os" "path" @@ -12,7 +11,7 @@ import ( "github.com/ipfs/go-cid" ipfs "github.com/ipfs/go-ipfs-api" - "github.com/ipfs/go-ipld-git" + ipldgit "github.com/ipfs/go-ipld-git" mh "github.com/multiformats/go-multihash" "github.com/remeh/sizedwaitgroup" ) @@ -154,7 +153,7 @@ func (f *Fetch) processSingle(hash string) error { ///////////////// - err = ioutil.WriteFile(*objectPath, object, 0444) + err = os.WriteFile(*objectPath, object, 0444) if err != nil { f.errCh <- fmt.Errorf("fetch: %v", err) return diff --git a/core/push.go b/core/push.go index f81ee11..d2c7544 100644 --- a/core/push.go +++ b/core/push.go @@ -5,7 +5,7 @@ import ( "encoding/hex" "errors" "fmt" - "io/ioutil" + "io" "log" "os" "os/signal" @@ -124,7 +124,7 @@ func (p *Push) doWork() error { return fmt.Errorf("push: %v", err) } - raw, err := ioutil.ReadAll(rawReader) + raw, err := io.ReadAll(rawReader) if err != nil { return fmt.Errorf("push: %v", err) } diff --git a/core/tracker.go b/core/tracker.go index cb4e8b0..20ce98a 100644 --- a/core/tracker.go +++ b/core/tracker.go @@ -8,7 +8,7 @@ import ( "github.com/dgraph-io/badger" ) -//Tracker tracks which hashes are published in IPLD +// Tracker tracks which hashes are published in IPLD type Tracker struct { db *badger.DB diff --git a/util/compare.go b/util/compare.go index 4da3c5c..0701d3a 100644 --- a/util/compare.go +++ b/util/compare.go @@ -5,7 +5,6 @@ import ( "compress/zlib" "fmt" "io" - "io/ioutil" "math" "os" "path/filepath" @@ -35,11 +34,11 @@ func CompareDirs(srcPath, dstPath string, ignore []string) error { return a[:len(a)-count] } - srcEntries, err := ioutil.ReadDir(srcPath) + srcEntries, err := os.ReadDir(srcPath) if err != nil { return err } - dstEntries, err := ioutil.ReadDir(dstPath) + dstEntries, err := os.ReadDir(dstPath) if err != nil { return err } diff --git a/util/copy.go b/util/copy.go index d6aef7d..1fa9edf 100644 --- a/util/copy.go +++ b/util/copy.go @@ -25,7 +25,6 @@ package util import ( "fmt" "io" - "io/ioutil" "os" "path/filepath" ) @@ -102,7 +101,7 @@ func CopyDir(src string, dst string) (err error) { return } - entries, err := ioutil.ReadDir(src) + entries, err := os.ReadDir(src) if err != nil { return }