#26 Fix TinyGo net/http wasm build via pinned upstream patch (Go 1.26)
TinyGo 0.41.1 and earlier vendor tinygo-org/net@e54965e, whose net/http js/wasm overlay (roundtrip_js.go) calls the private t.roundTrip fallback removed from Go 1.25+/1.26 net/http, so `pnpm run build` fails to compile on Go 1.26 (tinygo-org/tinygo#5467). No released TinyGo carries the fix yet: it landed in tinygo-org/net@1026408a on 2026-04-27, after 0.41.1 shipped 2026-04-22, and is already on TinyGo's dev branch. Keep Go 1.26 and apply the exact upstream fix in CI before the build: - .ci/tinygo-net-roundtrip.patch: byte-exact tinygo-org/net@1026408a diff (its parent e54965e is the commit 0.41.1 ships), targeting src/net/http/roundtrip_js.go. - ci.yml: new "Patch TinyGo net/http (temporary)" step applies it to $(tinygo env TINYGOROOT) via `git apply`, failing loudly on drift. - .gitattributes: force LF on *.patch so `git apply` works on the Linux runner regardless of the committer's platform. - README: document the temporary patch and its removal condition. Temporary: remove the patch and the CI step once a TinyGo release later than 0.41.1 ships the net fix. Tracking #26. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -38,9 +38,10 @@ jobs:
|
||||
with:
|
||||
go-version: '1.26'
|
||||
|
||||
# TinyGo is needed only for the Wasm Worker build (pnpm run build). The
|
||||
# 0.41.x line is the first with Go 1.26 support; install-binaryen (default
|
||||
# true) provides wasm-opt, which TinyGo invokes for the -target wasm build.
|
||||
# TinyGo is needed only for the Wasm Worker build (pnpm run build).
|
||||
# install-binaryen (default true) provides wasm-opt, which TinyGo invokes
|
||||
# for the -target wasm build. 0.41.1's vendored net/http js overlay is
|
||||
# patched just before the build (see "Patch TinyGo net/http" below).
|
||||
- name: Set up TinyGo
|
||||
uses: acifani/setup-tinygo@dd8a7075d951a7595b2ef2123ed0ab1af0c13e56 # v3.0.0
|
||||
with:
|
||||
@@ -79,6 +80,25 @@ jobs:
|
||||
echo "infra/go.mod not present; skipping (no-op until ticket #2)"
|
||||
fi
|
||||
|
||||
# TEMPORARY (tracking #26; tinygo-org/tinygo#5467): TinyGo 0.41.1 and
|
||||
# earlier vendor tinygo-org/net@e54965e, whose net/http js/wasm overlay
|
||||
# (roundtrip_js.go) calls the private t.roundTrip fallback that no longer
|
||||
# exists in Go 1.25+/1.26 net/http, so the wasm build fails to compile.
|
||||
# Apply the exact upstream fix (tinygo-org/net@1026408a) to the installed
|
||||
# TinyGo source. git apply exits non-zero (failing the job loudly) if the
|
||||
# source has drifted, so we notice when TinyGo changes upstream.
|
||||
# TODO: delete this step and .ci/tinygo-net-roundtrip.patch once a TinyGo
|
||||
# release later than 0.41.1 ships the fix (already on TinyGo's dev branch).
|
||||
- name: Patch TinyGo net/http (temporary)
|
||||
run: |
|
||||
patch_file="$PWD/.ci/tinygo-net-roundtrip.patch"
|
||||
tinygoroot="$(tinygo env TINYGOROOT)"
|
||||
echo "Applying $patch_file to $tinygoroot/src/net/http/roundtrip_js.go"
|
||||
git -C "$tinygoroot" apply --verbose "$patch_file" || {
|
||||
echo "::error::TinyGo net/http patch did not apply cleanly; TinyGo source may have changed. Update or remove .ci/tinygo-net-roundtrip.patch (see #26)."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Confirms the Wasm Worker builds end to end: workers-assets-gen emits the
|
||||
# JS shim and TinyGo compiles ./worker into build/app.wasm.
|
||||
- name: Build Wasm Worker
|
||||
|
||||
Reference in New Issue
Block a user