Skip to content

go-hass-agent: add macOS support - #317390

Open
mdevils wants to merge 1 commit into
Homebrew:mainfrom
mdevils:go-hass-agent-macos
Open

mdevils wants to merge 1 commit into
Homebrew:mainfrom
mdevils:go-hass-agent-macos

Conversation

@mdevils

@mdevils mdevils commented Oct 11, 2026 •

Copy link
Copy Markdown

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 :linux restriction and makes CGO_ENABLED conditional, since the agent's NVMe SMART support on macOS calls into IOKit/CoreFoundation via cgo (Linux has no such requirement and keeps building with CGO_ENABLED=0 as before).

What changed

  • Removed depends_on :linux.
  • ENV["CGO_ENABLED"] = OS.mac? ? "1" : "0" instead of a hardcoded "0".
  • bottle do ... end, service do ... end, and test do ... end are 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 build of the v14.17.0 tag succeeds cleanly.
  • CGO_ENABLED=0 (the current hardcoded value) fails with undefined: NVMeDevice / undefined: OpenNVMe from the agent's NVMe SMART dependency -- confirming the existing hardcoded 0 would not have worked for macOS, and that the conditional is actually necessary, not just defensive.
  • Ran the resulting binary the same way the formula's own test do block does (spawn with --server-port/--server-hostname, curl /register) and got a 200 response containing "Register".

  • Have you followed the guidelines for contributing?
  • Have you ensured that your commits follow the commit style guide?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>?
  • Is your test running fine brew test <formula>?
  • Does your build pass brew audit --strict <formula> (after doing HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>)? If this is a new formula, does it pass brew audit --new <formula>?

  • I did not use AI/LLM to create this PR, or I disclosed the tool/model below and reviewed its output; I did not attribute commits to AI and will answer maintainer questions and review comments myself without AI/LLM.

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.
@github-actions github-actions Bot closed this Oct 11, 2026
@github-actions github-actions Bot added go Go use is a significant feature of the PR or issue nodejs Node or npm use is a significant feature of the PR or issue missing network sandbox The formula does not define network sandbox settings labels Oct 11, 2026
@github-actions github-actions Bot reopened this Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go Go use is a significant feature of the PR or issue missing network sandbox The formula does not define network sandbox settings nodejs Node or npm use is a significant feature of the PR or issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant