chore: upgrade forge deps and fix builds on darwin - #86
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Upgrades Fil-Forge/Forge-related dependencies and adjusts the local build/test workflow so macOS (Darwin) builds can enable CGO (to support gosigar requirements in the Curio/Lotus dependency chain) while keeping non-Darwin builds CGO-free by default.
Changes:
- Update Makefile to set
CGO_ENABLEDbased on the host OS and use it forgo build/go test. - Bump Forge-related module versions in
go.mod. - Refresh corresponding checksums in
go.sum.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Makefile | Conditionally enables CGO on Darwin and propagates CGO_ENABLED into build/test commands. |
| go.mod | Updates Forge/Fil-Forge dependency versions. |
| go.sum | Updates module checksums to match the upgraded dependencies. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…rge/piri into ash/chore/upgrade-deps-2026-08-20
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 5 changed files in this pull request and generated no new comments.
Suppressed comments (1)
Makefile:16
- The comment about overriding CGO is misleading on Darwin: this Makefile already defaults
CGO_ENABLEDto 1 on Darwin, so the guidance about overriding withCGO_ENABLED=1only applies to non-Darwin. Consider rewording to describe the actual defaults and note that Darwin cross-compiles may needCGO_ENABLED=0.
# gosigar (via curio→lotus) has a pure-Go path on linux but needs cgo on darwin.
# Default to CGO-free builds on non-darwin platforms; override with CGO_ENABLED=1 if needed.
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.
Upgrades Forge deps and enables CGO on Darwin due to
gosigarrequiring it on macos. Also fixes the binary builds on release.Why does `gosigar` require CGO on Darwin?
On macOS the system stats gosigar reports only exist behind C library
interfaces, and the file that wraps them is a cgo file.
In gosigar (
github.com/elastic/gosigar) the darwin implementation is splitin two:
sigar_common_darwin.gostarts with a C preamble (#include <sys/sysctl.h>,<mach/mach_host.h>,<libproc.h>, …) andimport "C".It implements
Cpu.Get,Mem.Get,Swap.Get,LoadAverage.Get, processinfo, and the
sysctlbynamehelper by callinggetloadavg,host_statistics,host_processor_info,proc_pidinfo, andsysctlbynamedirectly.sigar_darwin.goandconcrete_sigar.goare pure Go and call into those.When
CGO_ENABLED=0, the Go toolchain silently drops every file that imports"C"from the package.sigar_common_darwin.govanishes, and the survivingpure-Go files fail to compile against the now-missing pieces. That is the
error signature piri's
make testproduced on macOS:The reason darwin uses C where Linux doesn't: on Linux all of this data is
plain text under
/procand/sys, sosigar_linux.gojust reads files.macOS has no
/proc; CPU, memory, and process stats come from Mach kernelAPIs (
host_statistics,host_processor_info) andlibproc, and Apple'sonly stable way to reach those is through the system C library. There is no
pure-Go path for the Mach calls (raw syscall numbers are not a supported
interface on macOS), so cgo is unavoidable. gosigar is also a direct port of
the old C libsigar (the VMware copyright header is still on the file), which
is why the darwin port stayed a thin C wrapper rather than using the partial
pure-Go
sysctlsupport ingolang.org/x/sys/unix.Note: The build passes in CI on MacOS due to a bug in the
unified-github-workflowsCI config that ended up enabling CGO for all builds. It's fixed in ipdxco/unified-github-workflows#148, but when merged and released we'll have to fix our CI config here as we won't be able to use"cgo": falseconfig since on MacOS it is required to be true.