cloudfoundry / cloudfoundry/gosigar
GetFileSystemUsage(...) returns Kilobytes instead of Bytes
Open
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 481
- Forks
- 198
- PR merge metrics
- No merged PRs in 30d
Description
GetFileSystemUsage returns Kilobytes instead of Bytes.
Example Code which should print the used Gigabytes:
package main
import (
"fmt"
sigar "github.com/cloudfoundry/gosigar"
)
func main() {
s := sigar.ConcreteSigar{}
fsUsage, _ := s.GetFileSystemUsage("/System/Volumes/Data")
gbUsed := float64(fsUsage.Used) / 1024 / 1024 / 1024 // converting bytes to Gigabytes
fmt.Printf("%3.2f GB used\n", gbUsed)
}
Result on my machine:
0.34 GB used
Expected result:
> df -h
Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
...
/dev/disk3s5 460Gi 338Gi 108Gi 76% 6446774 1131120840 1% /System/Volumes/Data
...
OS: macOS
gosigar version: 1.3.36
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the macOS-specific implementation of GetFileSystemUsage and trace how its Used value is obtained and represented. Compare the returned unit with the macOS df output shown in the issue. Done means the API reports Used in bytes, so the example's conversion produces a value consistent with df.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100