Background
The pkg/diskspace package introduced in #471 uses golang.org/x/sys/unix (unix.Statfs) to check available disk space. This makes the package Unix-only and will cause compilation failures on Windows.
Current State
pkg/diskspace/check.go imports golang.org/x/sys/unix without a build constraint
- Other packages in the project (e.g.,
pkg/xattr) also use Unix-specific syscalls
- The project currently only targets Linux and macOS in CI/release
Proposed Change
- Add
//go:build unix constraint to check.go (rename to check_unix.go)
- Create
check_other.go with //go:build !unix that returns nil (no-op on unsupported platforms)
- This allows the project to compile on Windows without breaking the disk space check on Unix
Priority
Low — the project does not currently support Windows, but adding build constraints is good practice for future portability.
Related
Background
The
pkg/diskspacepackage introduced in #471 usesgolang.org/x/sys/unix(unix.Statfs) to check available disk space. This makes the package Unix-only and will cause compilation failures on Windows.Current State
pkg/diskspace/check.goimportsgolang.org/x/sys/unixwithout a build constraintpkg/xattr) also use Unix-specific syscallsProposed Change
//go:build unixconstraint tocheck.go(rename tocheck_unix.go)check_other.gowith//go:build !unixthat returnsnil(no-op on unsupported platforms)Priority
Low — the project does not currently support Windows, but adding build constraints is good practice for future portability.
Related