go: ship moq.h and linux staticlibs so the Go module builds for consumers#1549
Conversation
…mers The published github.com/moq-dev/moq-go module was un-buildable: cgo failed with `'moq.h' file not found`, and linux targets had no archive to link against. Two gaps in the release packaging path: - uniffi-bindgen-go emits both moq.go and moq.h (moq.go's cgo preamble does `#include <moq.h>`), but every staging step only carried moq.go. package.sh now copies (and requires) moq.h next to moq.go, and the bindings flatten steps in check.sh / release-go.yml copy the whole moq/ dir so the header survives even if a uniffi version nests under uniffi/. - moq-ffi/build.sh's linux leg shipped only the .so cdylib, so the .a staticlib that Go links via cgo was never staged. It now copies both. Local `just go check` masked the header gap because it hit the same missing-moq.h bug only when actually run; this fixes that path too. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
WalkthroughThis PR updates build and packaging scripts to accommodate a change in the 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
The published
github.com/moq-dev/moq-gomodule (mirror populated byrelease-go.ymlonmoq-ffi-v*tags) was un-buildable for consumers. Verified againstv0.2.15from the Go module proxy. Two gaps in the release packaging path (not the local check path):uniffi-bindgen-goemits bothmoq.goandmoq.h, and the generatedmoq.gohas// #include <moq.h>in its cgo preamble. Every staging step only carriedmoq.go, soCGO_ENABLED=1 go buildfailed withfatal error: 'moq.h' file not found.rs/moq-ffi/build.sh's linux leg shipped only the.socdylib (an old comment claimed nothing links statically). Go links the.astaticlib via cgo, sopackage.shloggedgo lib linux_amd64: skipped, …/libmoq_ffi.a missingand the published module had no linux archive, despitecgo.goLDFLAGS and the docs claiming linux/amd64 + linux/arm64 support.Changes
rs/moq-ffi/build.sh— linux leg now copieslibmoq_ffi.aalongside the.so(cargo already produces it; crate-type is["staticlib","cdylib"]).go/scripts/package.sh— copiesmoq.hnext tomoq.go, and now requires it (fails loudly if absent, same asmoq.go).go/scripts/check.shand.github/workflows/release-go.yml— bindings flatten steps copy the wholemoq/dir instead of cherry-pickingmoq.go, so the header survives even if a future uniffi version nests output underuniffi/.This was discovered while building the
moq-dev/smokeinterop repo, whose Go cell currently fails for this reason.Reviewer notes
rs/moq-ffi/build.shis shared byrelease-kt.ymlandrelease-swift.ymltoo. The extra.ain the linuxlib/is inert for them (kt consumes the.sovia JNA; swift is apple-only).libmoq.ymlandmoq-gst.ymluse their own build scripts and are unaffected.just go checkactually hit the same missing-moq.hbug when run; this fixes that path as well, so it's no longer a false-positive.Test plan
bash -nclean onpackage.sh,check.sh,build.shactionlintclean onrelease-go.ymljust go checkpasses end-to-end:moq.his staged andgo vet/go build/go testsucceed (linux libs show "skipped" locally since only the host darwin target is built — populated in CI's per-target legs)release-go.ymldry-run produces a module containingmoq/moq.handmoq/lib/{linux_amd64,linux_arm64}/libmoq_ffi.a🤖 Generated with Claude Code