Skip to content

Commit bd532db

Browse files
author
Matt Allen
committed
Removed a problematic dep
1 parent 2f1db8e commit bd532db

File tree

3 files changed

+31
-7
lines changed

3 files changed

+31
-7
lines changed

go.mod

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module fs
2+
3+
go 1.22
4+
5+
require (
6+
github.com/stretchr/testify v1.9.0
7+
golang.org/x/sys v0.26.0
8+
)
9+
10+
require (
11+
github.com/davecgh/go-spew v1.1.1 // indirect
12+
github.com/pmezard/go-difflib v1.0.0 // indirect
13+
gopkg.in/yaml.v3 v3.0.1 // indirect
14+
)

go.sum

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
2+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
4+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
5+
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
6+
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
7+
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
8+
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
9+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
10+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
11+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
12+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

lock.go

+5-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package fs
33
import (
44
"errors"
55
"fmt"
6-
"github.com/minio/minio/pkg/disk"
6+
"golang.org/x/sys/unix"
77
"log"
88
)
99

@@ -53,7 +53,7 @@ func (f *FileOperation) CanMove(from, to string) error {
5353
if sErr != nil {
5454
return sErr
5555
}
56-
log.Println("Checking remaining space at "+getFolderFromPath(to))
56+
log.Println("Checking remaining space at " + getFolderFromPath(to))
5757
left, lErr := remainingSpace(getFolderFromPath(to))
5858
if lErr != nil {
5959
return lErr
@@ -75,9 +75,7 @@ func (f *FileOperation) Delete(from string) error {
7575
}
7676

7777
func remainingSpace(p string) (uint64, error) {
78-
di, err := disk.GetInfo(p)
79-
if err != nil {
80-
return 0, err
81-
}
82-
return di.Free, err
78+
var stat unix.Statfs_t
79+
err := unix.Statfs(p, &stat)
80+
return stat.Bavail * uint64(stat.Bsize), err
8381
}

0 commit comments

Comments
 (0)