Skip to content

Commit 8b87fa0

Browse files
committed
fix: resolve TinyGo toolchain platform resolution issue
Add platform transitions to Go component rules for proper WebAssembly targeting: • Import wasm_transition from rust:transitions.bzl in go/defs.bzl • Apply cfg = wasm_transition to go_wasm_component rule • Apply cfg = wasm_transition to go_wasm_component_wizer rule • Apply cfg = wasm_transition to go_wit_bindgen rule This resolves the toolchain resolution failure where Go components were trying to build for host platform instead of WebAssembly target platform. The TinyGo toolchain now properly resolves and builds Go components: - TinyGo v0.38.0 with WASI Preview 2 support - WebAssembly component generation via wasm-tools - Full integration with existing platform constraint system Tested and verified working with go_component examples.
1 parent b191454 commit 8b87fa0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

go/defs.bzl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Example usage:
2828
"""
2929

3030
load("//providers:providers.bzl", "WasmComponentInfo")
31+
load("//rust:transitions.bzl", "wasm_transition")
3132

3233
def _go_wasm_component_impl(ctx):
3334
"""Implementation of go_wasm_component rule using TinyGo + WASI Preview 2"""
@@ -352,6 +353,7 @@ EOF
352353
# TinyGo WebAssembly Component rule
353354
go_wasm_component = rule(
354355
implementation = _go_wasm_component_impl,
356+
cfg = wasm_transition,
355357
attrs = {
356358
"srcs": attr.label_list(
357359
allow_files = [".go"],
@@ -431,6 +433,7 @@ def _go_wit_bindgen_impl(ctx):
431433
# Standalone Go WIT bindings generation rule
432434
go_wit_bindgen = rule(
433435
implementation = _go_wit_bindgen_impl,
436+
cfg = wasm_transition,
434437
attrs = {
435438
"wit": attr.label(
436439
allow_single_file = [".wit"],
@@ -602,6 +605,7 @@ def _go_wasm_component_wizer_impl(ctx):
602605
# TinyGo WebAssembly Component rule with Wizer pre-initialization
603606
go_wasm_component_wizer = rule(
604607
implementation = _go_wasm_component_wizer_impl,
608+
cfg = wasm_transition,
605609
attrs = {
606610
"srcs": attr.label_list(
607611
allow_files = [".go"],

0 commit comments

Comments
 (0)