Summary
go build ./... and go test ./internal/utils/reflink fail on macOS because the package has no darwin-specific implementation file and the existing build tags exclude darwin from both alternatives.
Reproduction
Tested at commit 14b9a73 on darwin/arm64, go1.26.2:
$ go build ./...
# github.com/githubnext/apm/internal/utils/reflink
internal/utils/reflink/reflink.go:38:13: undefined: platformClone
internal/utils/reflink/reflink.go:55:14: undefined: deviceID
internal/utils/reflink/reflink.go:65:9: undefined: platformSupported
$ GOOS=linux go build ./... # passes
Root cause
The package contains:
reflink_linux.go — //go:build linux
reflink_other.go — //go:build !linux && !darwin
reflink.go — platform-agnostic dispatcher that calls platformClone, deviceID, platformSupported
On darwin, neither tagged file is selected, so the three helper symbols are undefined.
Notably, the dispatcher's own doc comment promises darwin support:
Modern filesystems (APFS on macOS, btrfs and XFS on Linux) support copy-on-write clones.
So a darwin implementation was intended but never landed.
Suggested fixes
Either:
- Implement it properly — add
reflink_darwin.go using clonefile(2) (APFS supports this natively via clonefileat/clonefile in <sys/clonefile.h>), matching the linux signatures. This honors the stated intent of the package.
- Stub it temporarily — broaden
reflink_other.go's build tag from !linux && !darwin to !linux, accepting the fallback (non-reflink) path on darwin until a real APFS implementation lands.
Option 2 unblocks the build immediately; option 1 delivers the documented behavior.
Related
Filing a separate issue for the underlying reason this wasn't caught: CI only runs on Ubuntu, so darwin-only build breaks are invisible.
Summary
go build ./...andgo test ./internal/utils/reflinkfail on macOS because the package has no darwin-specific implementation file and the existing build tags exclude darwin from both alternatives.Reproduction
Tested at commit
14b9a73ondarwin/arm64,go1.26.2:Root cause
The package contains:
reflink_linux.go—//go:build linuxreflink_other.go—//go:build !linux && !darwinreflink.go— platform-agnostic dispatcher that callsplatformClone,deviceID,platformSupportedOn darwin, neither tagged file is selected, so the three helper symbols are undefined.
Notably, the dispatcher's own doc comment promises darwin support:
So a darwin implementation was intended but never landed.
Suggested fixes
Either:
reflink_darwin.gousingclonefile(2)(APFS supports this natively viaclonefileat/clonefilein<sys/clonefile.h>), matching the linux signatures. This honors the stated intent of the package.reflink_other.go's build tag from!linux && !darwinto!linux, accepting the fallback (non-reflink) path on darwin until a real APFS implementation lands.Option 2 unblocks the build immediately; option 1 delivers the documented behavior.
Related
Filing a separate issue for the underlying reason this wasn't caught: CI only runs on Ubuntu, so darwin-only build breaks are invisible.