Skip to content

Commit

Permalink
Change go-os-rename to standard
Browse files Browse the repository at this point in the history
Since Go 1.5, os.Rename is consistent across platforms
  • Loading branch information
djdv committed Mar 15, 2018
1 parent 542131a commit ebb0eca
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
5 changes: 2 additions & 3 deletions convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (

"github.com/ipfs/go-datastore"
"github.com/ipfs/go-datastore/query"
"github.com/jbenet/go-os-rename"
)

func UpgradeV0toV1(path string, prefixLen int) error {
Expand Down Expand Up @@ -152,7 +151,7 @@ func Move(oldPath string, newPath string, out io.Writer) error {
// else we found something unexpected, so to be safe just move it
log.Warningf("found unexpected file in datastore directory: \"%s\", moving anyway\n", fn)
newPath := filepath.Join(newDS.path, fn)
err := osrename.Rename(oldPath, newPath)
err := os.Rename(oldPath, newPath)
if err != nil {
return err
}
Expand All @@ -173,7 +172,7 @@ func moveKey(oldDS *Datastore, newDS *Datastore, key datastore.Key) error {
if err != nil {
return err
}
err = osrename.Rename(oldPath, newPath)
err = os.Rename(oldPath, newPath)
if err != nil {
return err
}
Expand Down
5 changes: 2 additions & 3 deletions flatfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (

"github.com/ipfs/go-datastore"
"github.com/ipfs/go-datastore/query"
"github.com/jbenet/go-os-rename"

logging "github.com/ipfs/go-log"
)
Expand Down Expand Up @@ -286,7 +285,7 @@ func (fs *Datastore) renameAndUpdateDiskUsage(tmpPath, path string) error {
// Rename and add new file's diskUsage. If the rename fails,
// it will either a) Re-add the size of an existing file, which
// was sustracted before b) Add 0 if there is no existing file.
err = osrename.Rename(tmpPath, path)
err = os.Rename(tmpPath, path)
fs.updateDiskUsage(path, true)
return err
}
Expand Down Expand Up @@ -779,7 +778,7 @@ func (fs *Datastore) persistDiskUsageFile() {
return
}

osrename.Rename(tmp.Name(), filepath.Join(fs.path, DiskUsageFile))
os.Rename(tmp.Name(), filepath.Join(fs.path, DiskUsageFile))
}

func (fs *Datastore) readDiskUsageFile() int64 {
Expand Down
6 changes: 0 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@
"name": "go-log",
"version": "1.4.0"
},
{
"author": "jbenet",
"hash": "QmaeRR9SpXumU5tYLRkq6x6pfMe8qKzxn4ujBpsTJ2zQG7",
"name": "go-os-rename",
"version": "0.0.0"
},
{
"author": "jbenet",
"hash": "QmeiCcJfDW1GJnWUArudsv5rQsihpi4oyddPhdqo3CfX6i",
Expand Down

0 comments on commit ebb0eca

Please sign in to comment.