Skip to content

go: ship moq.h and linux staticlibs so the Go module builds for consumers#1549

Merged
kixelated merged 1 commit into
mainfrom
claude/sad-rhodes-41f463
May 30, 2026
Merged

go: ship moq.h and linux staticlibs so the Go module builds for consumers#1549
kixelated merged 1 commit into
mainfrom
claude/sad-rhodes-41f463

Conversation

@kixelated
Copy link
Copy Markdown
Collaborator

Summary

The published github.com/moq-dev/moq-go module (mirror populated by release-go.yml on moq-ffi-v* tags) was un-buildable for consumers. Verified against v0.2.15 from the Go module proxy. Two gaps in the release packaging path (not the local check path):

  • Missing C header. uniffi-bindgen-go emits both moq.go and moq.h, and the generated moq.go has // #include <moq.h> in its cgo preamble. Every staging step only carried moq.go, so CGO_ENABLED=1 go build failed with fatal error: 'moq.h' file not found.
  • Missing linux libs. rs/moq-ffi/build.sh's linux leg shipped only the .so cdylib (an old comment claimed nothing links statically). Go links the .a staticlib via cgo, so package.sh logged go lib linux_amd64: skipped, …/libmoq_ffi.a missing and the published module had no linux archive, despite cgo.go LDFLAGS and the docs claiming linux/amd64 + linux/arm64 support.

Changes

  • rs/moq-ffi/build.sh — linux leg now copies libmoq_ffi.a alongside the .so (cargo already produces it; crate-type is ["staticlib","cdylib"]).
  • go/scripts/package.sh — copies moq.h next to moq.go, and now requires it (fails loudly if absent, same as moq.go).
  • go/scripts/check.sh and .github/workflows/release-go.yml — bindings flatten steps copy the whole moq/ dir instead of cherry-picking moq.go, so the header survives even if a future uniffi version nests output under uniffi/.

This was discovered while building the moq-dev/smoke interop repo, whose Go cell currently fails for this reason.

Reviewer notes

  • rs/moq-ffi/build.sh is shared by release-kt.yml and release-swift.yml too. The extra .a in the linux lib/ is inert for them (kt consumes the .so via JNA; swift is apple-only). libmoq.yml and moq-gst.yml use their own build scripts and are unaffected.
  • The local just go check actually hit the same missing-moq.h bug when run; this fixes that path as well, so it's no longer a false-positive.

Test plan

  • bash -n clean on package.sh, check.sh, build.sh
  • actionlint clean on release-go.yml
  • just go check passes end-to-end: moq.h is staged and go vet/go build/go test succeed (linux libs show "skipped" locally since only the host darwin target is built — populated in CI's per-target legs)
  • CI release-go.yml dry-run produces a module containing moq/moq.h and moq/lib/{linux_amd64,linux_arm64}/libmoq_ffi.a

🤖 Generated with Claude Code

…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>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 29, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cae76bcb-16c7-447d-9a83-d580c4835b60

📥 Commits

Reviewing files that changed from the base of the PR and between 4d46f73 and 06fc069.

📒 Files selected for processing (4)
  • .github/workflows/release-go.yml
  • go/scripts/check.sh
  • go/scripts/package.sh
  • rs/moq-ffi/build.sh

Walkthrough

This PR updates build and packaging scripts to accommodate a change in the uniffi-bindgen-go output structure. The workflow release step, local binding check script, and Go module packaging now handle an entire bindings directory (preserving C headers like moq.h) instead of copying a single .go file. Existence checks were added for both the Go bindings and generated headers. The Rust FFI Linux packaging was updated to include both shared (.so) and static (.a) libraries.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: shipping moq.h and linux static libraries to fix Go module builds for consumers.
Description check ✅ Passed The description is comprehensive and directly related to the changeset, clearly explaining the problem, solution, and impact.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch claude/sad-rhodes-41f463

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kixelated kixelated merged commit 853ddde into main May 30, 2026
33 checks passed
@kixelated kixelated deleted the claude/sad-rhodes-41f463 branch May 30, 2026 00:38
This was referenced May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant