From dcb1de12b19f9a272de7f68900e4d133d9515167 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Wed, 23 Sep 2026 14:18:03 -0700 Subject: [PATCH] fix(go): compile the wrapper against the pinned ffi before releasing #3949 merged after moq-ffi-v0.4.0 was tagged and made the wrapper call TrackDemand/Demand. The next main push released moq.dev/moq v0.7.0 pinned to moq.dev/moq-ffi v0.4.0 (the Cargo.toml version), which lacks that API, so every consumer fails to build. package-wrapper.sh only ran go mod tidy, which never type-checks; build the staged module so a mismatch fails the release instead of publishing it. Co-Authored-By: Claude Opus 5.5 --- go/scripts/package-wrapper.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/go/scripts/package-wrapper.sh b/go/scripts/package-wrapper.sh index 75b4c8a9096..210d0db854c 100755 --- a/go/scripts/package-wrapper.sh +++ b/go/scripts/package-wrapper.sh @@ -158,7 +158,7 @@ See [moq-dev/moq/go/wrapper/README.md](https://github.com/moq-dev/moq/blob/main/ Licensed under MIT OR Apache-2.0. EOF -# --- 4. Resolve go.sum (skipped for dry-runs against an unpublished ffi tag) --- +# --- 4. Resolve go.sum and compile (skipped for dry-runs against an unpublished ffi tag) --- # GOPROXY=direct fetches the freshly-pushed ffi tag straight from its mirror, # dodging proxy.golang.org caching lag right after a release. if [[ "$TIDY" == true ]]; then @@ -166,6 +166,10 @@ if [[ "$TIDY" == true ]]; then cd "$PKG_STAGE" # GOWORK=off so an ambient parent go.work can't influence the staged go.sum. GOWORK=off GOFLAGS=-mod=mod GOPROXY="${GOPROXY:-direct}" go mod tidy + # Compile against the pinned ffi. tidy never type-checks, so a wrapper that + # calls ffi API newer than the published release (merged after the ffi tag, + # before its version bump) would otherwise ship uncompilable. + GOWORK=off GOPROXY="${GOPROXY:-direct}" CGO_ENABLED=1 go build ./... ) else echo " skipping go mod tidy (no go.sum staged)"