Repository navigation
Conversation
go-hass-agent gained macOS support in v14.17.0 (joshuar/go-hass-agent#960, Homebrew#963, Homebrew#964 -- disk usage, SMART status, and temperature sensors), so the Linux-only restriction is no longer accurate. Its NVMe SMART support on macOS needs cgo (IOKit/CoreFoundation), so CGO_ENABLED is now conditional on OS.mac? rather than hardcoded off. Verified locally on an M-series Mac: v14.17.0 builds and runs cleanly with CGO_ENABLED=1, including the formula's own test (serving /register and matching "Register"); CGO_ENABLED=0 fails to build with undefined: NVMeDevice, confirming the existing hardcoded 0 would not have worked for macOS.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
go-hass-agent was Linux-only until recently. Over a series of PRs merged into joshuar/go-hass-agent (#958, #960, #963, #964), it gained real macOS support: device/context setup, disk usage sensors, NVMe SMART status, and hardware temperature sensors, all implemented natively for macOS (no Linux emulation/compatibility layer).
v14.17.0-- the version this formula already installs -- is the first tagged release that includes all of that work, so go-hass-agent can now genuinely run on macOS, not just Linux.This PR updates the formula to reflect that: it removes the
depends_on :linuxrestriction and makesCGO_ENABLEDconditional, since the agent's NVMe SMART support on macOS calls into IOKit/CoreFoundation via cgo (Linux has no such requirement and keeps building withCGO_ENABLED=0as before).What changed
depends_on :linux.ENV["CGO_ENABLED"] = OS.mac? ? "1" : "0"instead of a hardcoded"0".bottle do ... end,service do ... end, andtest do ... endare all unchanged -- none of them needed platform-specific changes.Verification
I confirmed the actual risk in this change -- whether
v14.17.0's source really builds and runs correctly on macOS -- directly, on an M-series Mac:CGO_ENABLED=1 go buildof thev14.17.0tag succeeds cleanly.CGO_ENABLED=0(the current hardcoded value) fails withundefined: NVMeDevice/undefined: OpenNVMefrom the agent's NVMe SMART dependency -- confirming the existing hardcoded0would not have worked for macOS, and that the conditional is actually necessary, not just defensive.test doblock does (spawn with--server-port/--server-hostname, curl/register) and got a 200 response containing "Register".HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>?brew test <formula>?brew audit --strict <formula>(after doingHOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>)? If this is a new formula, does it passbrew audit --new <formula>?