- Add .golangci.yml with minimal linters (govet, ineffassign) - Run gofmt -s and goimports on all files to fix formatting - Disable fieldalignment and copylocks checks in govet
16 lines
405 B
Go
Executable File
16 lines
405 B
Go
Executable File
//go:build !windows && !openbsd && !netbsd
|
|
// +build !windows,!openbsd,!netbsd
|
|
|
|
package restore
|
|
|
|
import "syscall"
|
|
|
|
// getDiskSpace returns available disk space in bytes (Unix/Linux/macOS/FreeBSD)
|
|
func getDiskSpace(path string) (int64, error) {
|
|
var statfs syscall.Statfs_t
|
|
if err := syscall.Statfs(path, &statfs); err != nil {
|
|
return 0, err
|
|
}
|
|
return int64(statfs.Bavail) * int64(statfs.Bsize), nil
|
|
}
|