Skip to content

Add Go and C# .NET language support #31

@richardkiene

Description

@richardkiene

Summary

Add support for building and running Go and C# .NET applications as WASM modules. Unlike Python and Node.js which require interpreter runtimes, both Go and .NET compile directly to WASM.

Research

Go

  • Go 1.21+ has native WASI support via GOOS=wasip1 GOARCH=wasm
  • Go 1.24 (2025) adds WASI reactor support with go:wasmexport directive and -buildmode=c-shared for long-running HTTP services
  • Compiles directly to WASM - no interpreter runtime needed
  • Limitation: WASI preview 1 has partial socket support

Build command:

GOOS=wasip1 GOARCH=wasm go build -o app.wasm

Sources:

C# .NET

  • .NET 8 has experimental WASI workload (wasi-experimental)
  • .NET 10 (Nov 2025) has first-class WASI support with dedicated WASM team, Native AOT
  • Uses Wasi.Sdk NuGet package or componentize-dotnet from Bytecode Alliance
  • Native AOT compilation produces standalone WASI-compliant .wasm files
  • No interpreter runtime needed

Build approach:

dotnet add package Wasi.Sdk --prerelease
dotnet build

Sources:

Implementation Plan

1. Go Support

Add Go builder in CLI (fabricks/src/builders/go.rs):

  • Detect Go projects (go.mod)
  • Run GOOS=wasip1 GOARCH=wasm go build
  • For HTTP services (Go 1.24+), use -buildmode=c-shared for reactor mode

2. .NET Support

Add .NET builder in CLI (fabricks/src/builders/dotnet.rs):

  • Detect .NET projects (.csproj)
  • Ensure Wasi.Sdk package is added
  • Run dotnet build with appropriate WASI configuration

3. Examples

Create example projects:

  • examples/go-hello/ - Simple command module
  • examples/go-http/ - HTTP service using Go 1.24 reactor mode
  • examples/dotnet-hello/ - Simple command module
  • examples/dotnet-http/ - HTTP service

4. No Runtime Layer Needed

Unlike Python/Node.js interpreted runtimes, Go and .NET compile directly to WASM. The OCI images will be simple single-layer modules (like Rust examples), not multi-layer interpreted modules.

Acceptance Criteria

  • fabricks build auto-detects and builds Go projects
  • fabricks build auto-detects and builds .NET projects
  • fabricks run works for Go WASM modules
  • fabricks run works for .NET WASM modules
  • Example go-hello command module works
  • Example go-http HTTP service works (if Go 1.24 reactor support is feasible)
  • Example dotnet-hello command module works
  • Example dotnet-http HTTP service works
  • Documentation updated

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions