Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
c13133d
add go sdk bindings foundation and go-bindgen-fixup dev tool
noise64 Jul 22, 2026
dcca272
go sdk core: registry, dispatch, reflection schemas, native tests
noise64 Jul 22, 2026
cb64cf8
go sdk: compile codecs per type; add containers, option and result
noise64 Jul 22, 2026
3696ec8
go sdk: variants and enums
noise64 Jul 22, 2026
7e42c45
go sdk: markers, time types, secrets and an orders example
noise64 Jul 22, 2026
120a451
point generated go glue at the hand-written export packages
noise64 Jul 22, 2026
10c654e
go sdk: emit recursive types as named defs via ref-type
noise64 Jul 22, 2026
95cced3
go sdk: typed cross-agent rpc with futures
noise64 Jul 23, 2026
b437043
drop redundant comment on phantom id generation
noise64 Jul 23, 2026
b2dcaf9
go sdk: publish as a monorepo subdirectory module
noise64 Jul 23, 2026
50a4dc8
go sdk: move module to sdks/go/golem so imports need no alias
noise64 Jul 23, 2026
a98f778
cli: go language support (templates, build pipeline, sdk overrides)
noise64 Jul 23, 2026
6929288
go templates: tidy before build, drop httpApi until mount is supported
noise64 Jul 23, 2026
ceb6f7b
go templates: put build output in the app-root golem-temp
noise64 Jul 23, 2026
aa9f9fe
go templates: drop the comment-only agent golem.yaml
noise64 Jul 23, 2026
2e516e6
go promotion: leave golem-temp at the app root
noise64 Jul 23, 2026
8c776a2
go cli: dep-install mechanism, real presets, go.mod fix step, tool ch…
noise64 Jul 24, 2026
8af09e9
go cli: cache go mod tidy against post-tidy state; avoid spurious go.…
noise64 Jul 24, 2026
ac8c4a5
go cli: ignore trailing-whitespace-only go.mod diffs in the fix step
noise64 Jul 24, 2026
bcac6e2
go sdk: handlers signal failure by panic, not error return; add Must/…
noise64 Jul 24, 2026
9389d95
go sdk: net/http RoundTripper over wasi:http/client, auto-installed
noise64 Jul 24, 2026
0215619
go sdk: add Must2 for (value, extra, error) client APIs
noise64 Jul 24, 2026
149f1fd
go examples: stop tracking built .wasm; ignore build outputs
noise64 Jul 27, 2026
5e76de9
go template: update counter to panic-not-error handler shape
noise64 Jul 27, 2026
2128476
go sdk: compile-error test for cross-agent client-type mismatch
noise64 Jul 27, 2026
119f5ee
go sdk: NameType to pin a type's cross-language type-id
noise64 Jul 27, 2026
4607787
go sdk: typed ParseAgentID with UUID phantom id
noise64 Jul 27, 2026
c6a7f4e
go sdk: http request-options from context deadline; fuller error-code…
noise64 Jul 27, 2026
64391d0
go sdk: document context-deadline timeouts; http.Client.Timeout is in…
noise64 Jul 27, 2026
704d88e
makefile: fix go-bindgen-fixup relative path in generate-sdk-go-bindings
noise64 Jul 27, 2026
3b401a4
ci: add build-golem-go job (bindings check, vet, wasip1 build, go test)
noise64 Jul 27, 2026
70447b1
skills: cover go sdk in wit-sync, pre-pr, and fix go vet scope
noise64 Jul 27, 2026
dade7d4
go sdk: relicense to apache 2.0 (license file + source headers)
noise64 Jul 27, 2026
0235e78
go sdk: collect definition errors and report them at discovery instea…
noise64 Jul 27, 2026
4d83b54
go sdk: http mount and per-method endpoints published in agent metadata
noise64 Jul 27, 2026
2047b6b
go sdk: native tests for value helpers, http verbs, registry adapters…
noise64 Jul 27, 2026
b0d0fe5
go template/examples: put each argument on its own line in wrapped calls
noise64 Jul 27, 2026
88c1587
go sdk: detect DSL misuse (repeated options, shared id type, intra-ag…
noise64 Jul 27, 2026
9cc7455
go sdk: encapsulate definition state behind a single defs pointer for…
noise64 Jul 27, 2026
9479c1b
go sdk tests: guard withDefs against parallel/nested use so shared-de…
noise64 Jul 27, 2026
dc70349
go sdk: instance-based definitions with a pure discover(); drop the g…
noise64 Jul 27, 2026
b01d5ca
go sdk: detect nil init/handler; document the thin logic-free wrapper…
noise64 Jul 27, 2026
af47793
go sdk: snapshotting — save/load exports, Snapshotter interface, snap…
noise64 Jul 27, 2026
66ea9f5
go templates: composable package-per-agent with a merged main.go barrel
noise64 Jul 27, 2026
8d0b045
go sdk: native tests for pure rpc/http/client helpers; document test …
noise64 Jul 27, 2026
a59bf9c
go sdk: cli integration test (test_go_counter) + go toolchain in it-c…
noise64 Jul 27, 2026
8363c4b
ci: cache componentize-go patched-go toolchain in it-cli job
noise64 Jul 28, 2026
c76c61a
go sdk: config + secrets declarations and typed reads (descriptor style)
noise64 Jul 28, 2026
b4daa8f
go sdk: config-on-rpc overrides via WithConfigValue on ClientFor
noise64 Jul 28, 2026
97567dd
go sdk: struct/record config authoring (ConfigOf + LoadConfig)
noise64 Jul 28, 2026
c8a4623
go sdk: comprehensive demo app exercising all implemented features
noise64 Jul 28, 2026
adbbc98
go sdk: remove examples (superseded by playground demo app + templates)
noise64 Jul 28, 2026
0d52c42
go templates: drop TS-ism 'barrel'; describe main.go as blank-import …
noise64 Jul 28, 2026
844c52d
go sdk: doc comments start with the identifier (golint form)
noise64 Jul 28, 2026
edb7dbc
go sdk: test enforcing doc comments start with the identifier
noise64 Jul 28, 2026
1d41df8
go sdk: enforce doc-comment form via staticcheck ST102x in CI (drop b…
noise64 Jul 28, 2026
d3ff035
go sdk: lint with golangci-lint via official action (replace ad-hoc s…
noise64 Jul 28, 2026
49deae2
go sdk: agent-attached context-scoped config; config-only live secret…
noise64 Jul 28, 2026
babef14
go sdk: fail-loud config/secret getters (bare value, panic; drop Must)
noise64 Jul 28, 2026
d4bd6a1
go sdk: config rides on the agent handle; DX cleanups (single-value D…
noise64 Jul 28, 2026
016ae7d
go sdk: cache materialized config per worker; secrets stay live
noise64 Jul 28, 2026
e329f25
go sdk: fail-loud rpc/client (bare values, panic on infra failure; al…
noise64 Jul 29, 2026
cdad086
go sdk: bridge Result to (value, error) via Get; ResultError preserve…
noise64 Jul 29, 2026
ee9877b
go sdk: promises (human-in-the-loop create/await/complete) — typed Pr…
noise64 Jul 29, 2026
df78e9b
Merge remote-tracking branch 'origin/main' into go-sdk
noise64 Jul 29, 2026
ea64b46
go sdk: durability helpers (atomically, persistence/idempotence guard…
noise64 Jul 29, 2026
1552a92
go sdk: transactions/saga (fallible + infallible, compensating operat…
noise64 Jul 29, 2026
90faf34
go sdk: retry-policy DSL as the retry subpackage (builder + predicate…
noise64 Jul 29, 2026
3e3ed2b
go sdk: document worker-global concurrency contract on durability/tra…
noise64 Jul 29, 2026
19a02bf
go sdk: soften concurrency notes to describe current worker-level sco…
noise64 Jul 30, 2026
a817777
go sdk: read-only method option with cache policy (no-cache / until-w…
noise64 Jul 30, 2026
dd2156d
go sdk: promise webhook — Promise[T].WebhookURL() mints an external c…
noise64 Jul 30, 2026
fe08fe6
go sdk: add Must0 helper for error-only fallible calls
noise64 Jul 30, 2026
bb4c147
go sdk: keyvalue wrapper (wasi:keyvalue durable store + typed Store[T])
noise64 Jul 30, 2026
7bf2a03
go sdk: blobstore wrapper (wasi:blobstore durable object store + type…
noise64 Jul 30, 2026
4379891
go sdk: websocket wrapper (golem:websocket client + typed messages)
noise64 Jul 30, 2026
067afad
go sdk: rdbms postgres wrapper (database/sql-style db/tx/row; any-par…
noise64 Jul 30, 2026
6e57d26
go sdk: rdbms tagName keys on generated constants (reorder-proof, ren…
noise64 Jul 30, 2026
3356654
go sdk: rdbms mysql wrapper (database/sql-style db/tx/row; signed+uns…
noise64 Jul 30, 2026
de46717
go sdk: rdbms postgres exotic value families (typed ranges/enum/spars…
noise64 Jul 30, 2026
263457d
go sdk: rdbms postgres typed Row getters for exotic families (Int4Ran…
noise64 Jul 30, 2026
674bd4a
docs: go env vars + logging use the stdlib (os.Getenv/os.Environ, log…
noise64 Jul 30, 2026
191a501
go sdk: wasi:logging slog handler (golem/log) auto-installed on start…
noise64 Jul 30, 2026
b02982e
Merge branch 'main' into go-sdk
noise64 Jul 30, 2026
fd12402
go sdk: fix custom-error payload lost as struct dump (remote panic me…
noise64 Jul 31, 2026
29a5ba4
go sdk: consistency pass — RemoteCallError.Msg->Message, uniform gole…
noise64 Jul 31, 2026
1f71e64
go sdk: extract UUID to golem/uuid leaf (golem.UUID aliases it); rdbm…
noise64 Jul 31, 2026
0a9f39a
go sdk: share rdbms ErrorKind via rdbms/types (postgres+mysql alias i…
noise64 Jul 31, 2026
2ae36fe
go sdk: typed AgentError with Kind so agent-call failures are recover…
noise64 Jul 31, 2026
4039034
go sdk: report agent-supplied unencodable values (bad variant case/en…
noise64 Jul 31, 2026
7738ba5
go sdk: panic with fmt.Errorf uniformly (+ PanicError.Unwrap) so reco…
noise64 Jul 31, 2026
e5e94d3
go sdk: split codec.go into codec.go (engine) + codec_scalar.go + cod…
noise64 Jul 31, 2026
5045e79
Merge branch 'main' into go-sdk
noise64 Jul 31, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .agents/skills/modifying-wit-interfaces/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ sub-projects below by copying from the root. **Never manually edit a sub-project
| `sdks/ts/wit/deps/` | **all** root deps + golem-ai (overlaid from `sdks/ts/wit/golem-ai`) |
| `sdks/scala/wit/deps/` | **all** root deps |
| `sdks/moonbit/golem_sdk/wit/deps/` | **all** root deps |
| `sdks/go/golem/wit/deps/` | **all** root deps |

The exact copy lists live in the `wit-golem-common`, `wit-golem-cli`, and
`wit-sdks` tasks in `Makefile.toml`.
Expand Down Expand Up @@ -90,7 +91,7 @@ This mirrors the correct subset of the root `wit/deps/` into each sub-project, i
cargo make check-wit
```

This re-runs the sync and then `git status` over every per-crate `wit/deps` copy (golem-common, golem-cli, and all four SDKs) to ensure the committed WIT files match what the sync produces. CI runs this; if it fails, you forgot to run `cargo make wit` (or you hand-edited a generated sub-project copy).
This re-runs the sync and then `git status` over every per-crate `wit/deps` copy (golem-common, golem-cli, and all five SDKs — rust, ts, scala, moonbit, go) to ensure the committed WIT files match what the sync produces. CI runs this; if it fails, you forgot to run `cargo make wit` (or you hand-edited a generated sub-project copy).

### Step 4: Build and verify

Expand Down Expand Up @@ -142,7 +143,8 @@ If WIT changes affect SDK interfaces:
2. **TS SDK**: Rebuild packages (`npx pnpm run build` in `sdks/ts/`), then rebuild agent template WASM (`npx pnpm run build-agent-template`)
3. **Scala SDK**: Regenerate `agent_guest.wasm`, adjust Scala SDK types or codecs if the WIT shape changed, and run the relevant Scala test suites
4. **MoonBit SDK**: Regenerate WIT bindings (`wit-bindgen moonbit` in `sdks/moonbit/golem_sdk/`), then `moon fmt` and `moon check --target wasm`
5. **Test components**: Rebuild any test components that use the changed interfaces (see their `AGENTS.md`)
5. **Go SDK**: Regenerate WIT bindings (`cargo make generate-sdk-go-bindings`), then `GOOS=wasip1 GOARCH=wasm go build ./...` in `sdks/go/golem/`
6. **Test components**: Rebuild any test components that use the changed interfaces (see their `AGENTS.md`)

## Checklist

Expand Down
2 changes: 2 additions & 0 deletions .agents/skills/pre-pr-checklist/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Choose tests based on what you changed. **Do not run `cargo make test`** — it
| Rust SDK (`sdks/rust/`) | `cargo test -p golem-rust` + `cargo make worker-executor-tests` |
| TypeScript SDK (`sdks/ts/`) | `npx pnpm run test` (in `sdks/ts/`) + `cargo make cli-integration-tests` |
| MoonBit SDK (`sdks/moonbit/`) | `moon test` (in `sdks/moonbit/golem_sdk/`) |
| Go SDK (`sdks/go/golem/`) | `go test ./...` (in `sdks/go/golem/`); host-call paths only build under a generated app — see the `sdk-development` skill |
| CLI structured output/schema | `cargo test -p golem-cli cli_output_schema_ --lib` + `cargo make check-cli-output-schema` |
| CLI JSON output affecting skill tests | Update affected `golem-skills/tests/harness` code, tests, or scenarios. Run `npm run build && npm test` in `golem-skills/tests/harness` only if harness TypeScript code/tests changed. |

Expand All @@ -54,6 +55,7 @@ cargo make worker-executor-tests-misc
| HTTP API endpoints | `cargo make generate-openapi` then `cargo clean -p golem-client && cargo build -p golem-client` (also refreshes `docs/src/content/rest-api/*.mdx`) |
| Service config structs/defaults | `cargo make generate-configs` |
| WIT interfaces | `cargo make wit` |
| Go SDK WIT bindings (after a WIT change) | `cargo make generate-sdk-go-bindings` |
| TS SDK runtime code | `npx pnpm run build-agent-template` (in `sdks/ts/`) |
| Skill catalog (`golem-skills/skills/**`) | `cargo make generate-docs-skills` (refreshes `docs/src/content/how-to-guides/*.mdx`) |
| CLI output schema summary | `cargo make update-cli-output-schema-summary` |
Expand Down
100 changes: 95 additions & 5 deletions .agents/skills/sdk-development/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: sdk-development
description: "Working on the Rust, TypeScript, or MoonBit SDKs in sdks/. Use when modifying SDK code, adding SDK features, or testing SDK changes with the main Golem platform."
description: "Working on the Rust, TypeScript, MoonBit, or Go SDKs in sdks/. Use when modifying SDK code, adding SDK features, releasing an SDK, or testing SDK changes with the main Golem platform."
---

# SDK Development
Expand Down Expand Up @@ -155,6 +155,94 @@ moon fmt
moon info # Regenerate .mbti interface files
```

## Go SDK (`sdks/go/golem/`)

Module path **`github.com/golemcloud/golem/sdks/go/golem`**, package `golem`.

The directory is `sdks/go/golem`, not `sdks/go`, on purpose: Go binds an import to the *package
clause*, but tooling and readers expect it to match the **last path element**. Naming the directory
`golem` makes them agree, so agents import the SDK with no alias:

```go
import "github.com/golemcloud/golem/sdks/go/golem" // binds `golem`
```

A hyphenated name (`golem-go-sdk`) could not do this — hyphens are not valid Go identifiers, so it
would force an alias back. It also leaves `sdks/go/` free for siblings.

Built with
`componentize-go`, which is pinned per-project through Go's `tool` directive — never installed
globally.

### Building and testing

```shell
cd sdks/go/golem
go test ./... # native tests; fast, no wasm needed
go vet . # host vet, hand-written package
GOOS=wasip1 GOARCH=wasm go build ./... # compile everything for the real target
GOOS=wasip1 GOARCH=wasm go vet -unsafeptr=false -composites=false .
```

Vet is scoped to `.`, not `./...`: the generated `internal/wit` bindings legitimately trip vet's
`unsafe.Pointer` / unkeyed-field checks, so the whole tree is *compiled* (the `go build` above), not
vetted, for the wasm target. CI runs exactly this set — plus a "bindings are committed" check — in the
`build-golem-go` job (`.github/workflows/ci.yaml`).

Native tests cover everything that does not reach a host import. `empty.s` lets a generated package
*compile* for the host, but the linker still needs a definition for any `//go:wasmimport` symbol that
host-arch code actually **references** — so RPC calls, `Future`, and `ClientFor` can only run under
wasm. Exercise those by creating an app with `golem app new … go` in a playground and building it;
the playground's `.golem-sdk-overrides` points the generated `go.mod` at this checkout.

### Regenerating WIT bindings

```shell
cargo make generate-sdk-go-bindings
```

Generated code lands in `internal/wit/` and is **wiped on every run**. The hand-written export slots
in `internal/exports/` survive because `--export-pkg-name` points the generated glue at them. The task
also runs `dev-tools/go-bindgen-fixup`, which works around two upstream wit-bindgen `crates/go` bugs
(tag-constant collisions, and a missing `empty.s` for the exports package).

### ⚠️ Releasing: Go has no package registry

Every other SDK publishes to a registry (crates.io / npm / maven / mooncakes) from a workflow
triggered by a `golem-<lang>-v*` tag. **Go has none — the git tag *is* the release**, read directly
from this repo by `proxy.golang.org`. There is no publish workflow to run.

Because the module lives in a subdirectory, Go **requires** the tag to be prefixed with that
subdirectory. This is a Go rule, not a choice:

```
sdks/go/golem/v0.1.0 ✅ the only form Go recognises
golem-go-v0.1.0 ❌ invisible to Go — do not use
```

Notes:

- This deliberately breaks the `golem-<lang>-v*` convention the other SDKs follow. It cannot be
avoided; see <https://go.dev/ref/mod> ("module subdirectory ... also serves as a prefix for
semantic version tags").
- It does **not** collide with anything. There is no root `go.mod`, so the repo's `v1.5.x` release
tags are invisible to Go, and no existing tag has the `sdks/go/golem/` shape.
- Consumers using the default `GOPROXY` download only the `sdks/go/golem` subtree (~7 MB), not the
whole repository. Only `GOPROXY=direct` clones the full repo, once per module cache. Repo size is
not a concern: the mirror serves far larger monorepos of exactly this shape (aws-sdk-go-v2 is
~1.2 GB with subdirectory-tagged modules); the only hard limit is 500 MiB on the *module zip*.
- The mirror stores a module permanently only if it can **detect a license**, and Go has no metadata
field for it — `sdks/go/golem/LICENSE` is the only mechanism, so it must stay in the module subtree.
It carries the Apache License 2.0 (the current SDK-license direction; a later session aligns the
other SDKs, which still ship the Golem Source License for now).

### Local SDK overrides

`GOLEM_GO_PATH` (or `GOLEM_PATH`, which derives it) makes the CLI emit a `replace` directive into a
generated app's `go.mod`, pointing at the local checkout. This is how the playground tests SDK changes
without publishing — and, until the first tag exists, the **only** way a generated Go app can resolve
the SDK.

## Downstream Rebuild Requirements

SDK changes can require rebuilding test components. This is the most common source of errors.
Expand All @@ -176,7 +264,8 @@ SDK changes can require rebuilding test components. This is the most common sour

## WIT Dependencies

Both SDKs have WIT files synced from the root `wit/` directory. **Never manually edit** `wit/deps/` in either SDK.
Every SDK has WIT files synced from the root `wit/` directory. **Never manually edit** `wit/deps/` in
any SDK — `cargo make wit` mirrors them, and `cargo make diff-wit` guards against drift.

```shell
# From repository root
Expand All @@ -189,6 +278,7 @@ cargo make wit
2. SDK builds successfully
3. SDK tests pass
4. Agent template rebuilt (if TS SDK runtime code changed)
5. Dependent test components rebuilt (if any)
6. Platform tests pass (`cargo make worker-executor-tests` for Rust SDK, `cargo make cli-integration-tests` for TS SDK)
7. Code formatted and linted
5. Go SDK: a generated app still builds (the only cover for host-call paths)
6. Dependent test components rebuilt (if any)
7. Platform tests pass (`cargo make worker-executor-tests` for Rust SDK, `cargo make cli-integration-tests` for TS SDK)
8. Code formatted and linted
82 changes: 82 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,28 @@ jobs:
working-directory: sdks/moonbit/golem_sdk_tools
run: moon update

- name: Setup Go
uses: actions/setup-go@v5
with:
# Stock Go, tracking the version pinned in the module; componentize-go
# is a pinned `go tool` (go.mod) that fetches its own toolchain, so the
# Go SDK's CLI integration test (test_go_counter) needs only this.
go-version-file: sdks/go/golem/go.mod
cache-dependency-path: sdks/go/golem/go.sum

- name: Cache componentize-go toolchain
uses: actions/cache@v5
with:
# On first `golem build` of a Go component, componentize-go downloads a
# full patched Go toolchain into this dir (the "will use downloaded
# version" build-log line) — hundreds of MB. Cache it so the Go SDK's
# CLI integration test doesn't re-fetch it each run. Keyed on the SDK
# go.sum, which tracks the pinned componentize-go version.
path: ~/.cache/componentize-go
key: componentize-go-${{ runner.os }}-${{ hashFiles('sdks/go/golem/go.sum') }}
restore-keys: |
componentize-go-${{ runner.os }}-

- name: Sync WIT dependencies
run: cargo make wit

Expand Down Expand Up @@ -621,6 +643,66 @@ jobs:
run: cargo test --all-features
working-directory: sdks/rust

build-golem-go:
runs-on: blacksmith
steps:
- uses: actions/checkout@v5

- name: Setup Go
uses: actions/setup-go@v5
with:
# Tracks the version pinned in the module (currently go 1.25.5); stock
# Go only — the SDK deliberately does not use TinyGo.
go-version-file: sdks/go/golem/go.mod
cache-dependency-path: sdks/go/golem/go.sum

# cargo-make drives the WIT dep sync and the go-bindgen-fixup step that the
# bindings regeneration runs. componentize-go itself is a pinned `go tool`
# (go.mod), so no wasm-tools / WASI SDK are needed here.
- uses: ./.github/actions/setup-rust
with:
use-cache: 'false'
install-cargo-make: 'true'

# Regenerate the committed WIT bindings (syncs wit/deps first via the task's
# `wit` dependency) and fail if they drift from what's checked in — mirrors
# the "types are committed" gate the TS and Scala SDKs use.
- name: Regenerate Go WIT bindings
run: cargo make generate-sdk-go-bindings

- name: Verify Go WIT bindings are committed
run: |
if ! git diff --exit-code sdks/go/golem/internal/wit; then
echo "❌ sdks/go/golem/internal/wit differs from the committed version."
echo "Please run 'cargo make generate-sdk-go-bindings' and commit the result."
exit 1
fi

# Lint the hand-written package with golangci-lint (the standard Go
# meta-linter: govet, errcheck, ineffassign, staticcheck, unused + the
# doc-comment-form checks). Config + generated-code exclusions live in
# sdks/go/golem/.golangci.yml. The official action fetches a pinned binary
# and caches analysis — this replaces the host `go vet` step too, since its
# govet covers it (and the .golangci.yml exclusions handle the generated
# internal/wit bindings that forced the old vet flag workaround).
- name: Lint (golangci-lint)
uses: golangci/golangci-lint-action@v9
with:
version: v2.12
working-directory: sdks/go/golem

- name: Vet (wasip1)
working-directory: sdks/go/golem
run: GOOS=wasip1 GOARCH=wasm go vet -unsafeptr=false -composites=false .

- name: Build for wasip1
working-directory: sdks/go/golem
run: GOOS=wasip1 GOARCH=wasm go build ./...

- name: Run tests
working-directory: sdks/go/golem
run: go test ./...

build-golem-ts:
runs-on: blacksmith
steps:
Expand Down
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ tracing-serde = "0.2.0"
tracing-subscriber = { version = "0.3.20", features = ["env-filter", "fmt", "std", "json", ] }
tracing-test = "0.2.5"
tree-sitter = "0.26.5"
tree-sitter-go = "0.23.4"
tree-sitter-json = "0.24.8"
tree-sitter-rust = "0.24.0"
tree-sitter-typescript = "0.23.2"
Expand Down
30 changes: 29 additions & 1 deletion Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ args = [
"--src", "wit/deps", "--dst", "sdks/ts/wit/deps",
"--src", "wit/deps", "--dst", "sdks/scala/wit/deps",
"--src", "wit/deps", "--dst", "sdks/moonbit/golem_sdk/wit/deps",
"--src", "wit/deps", "--dst", "sdks/go/golem/wit/deps",
]

[tasks.wit-golem-cli]
Expand All @@ -129,7 +130,7 @@ args = [
private = true
script_runner = "@duckscript"
script = '''
status = exec git status --porcelain -- golem-common/wit/deps cli/golem-cli/wit/deps sdks/rust/golem-rust/wit/deps sdks/ts/wit/deps sdks/scala/wit/deps sdks/moonbit/golem_sdk/wit/deps
status = exec git status --porcelain -- golem-common/wit/deps cli/golem-cli/wit/deps sdks/rust/golem-rust/wit/deps sdks/ts/wit/deps sdks/scala/wit/deps sdks/moonbit/golem_sdk/wit/deps sdks/go/golem/wit/deps
ok = eq ${status.code} 0
if not ${ok}
echo "git status failed (exit ${status.code}):"
Expand Down Expand Up @@ -403,6 +404,33 @@ else
fi
'''

[tasks.generate-sdk-go-bindings]
description = "Regenerates the Go SDK's WIT bindings (sdks/go/golem/internal/wit)"
dependencies = ["wit"]
cwd = "./sdks/go/golem"
script_runner = "@duckscript"
script = '''
# The componentize-go version is pinned in sdks/go/golem/go.mod via the `tool` directive
# (never `latest`); `go tool` therefore resolves the exact pinned build.
# --all-features is a GLOBAL flag and must precede the subcommand: golem's p3 WIT
# uses @unstable annotations (timezone).
# Imports + the wasmexport glue are generated into internal/wit (wiped each run).
# The export packages are NOT generated: --export-pkg-name points the glue at
# internal/exports, which we hand-write (the `Exports` slots the SDK fills in at
# init). That keeps generated and hand-written code strictly separated.
exec --fail-on-error go tool componentize-go --all-features bindings --output internal/wit --pkg-name github.com/golemcloud/golem/sdks/go/golem/internal/wit --export-pkg-name github.com/golemcloud/golem/sdks/go/golem/internal/exports --format

# Works around a wit-bindgen crates/go codegen bug; see dev-tools/go-bindgen-fixup.
exec --fail-on-error cargo run --quiet --manifest-path ../../../dev-tools/Cargo.toml --bin go-bindgen-fixup -- internal/wit
exec --fail-on-error gofmt -w internal/wit

# The generated code is wasm-only (//go:wasmimport declarations have no bodies),
# so it can only be type-checked for the wasip1 target, not the host.
set_env GOOS wasip1
set_env GOARCH wasm
exec --fail-on-error go build ./internal/wit/...
'''

[tasks.clean-sdk-scala]
description = "Cleans the Scala SDK"
cwd = "./sdks/scala"
Expand Down
1 change: 1 addition & 0 deletions cli/golem-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ tracing = { workspace = true }
tracing-log = "0.2.0"
tracing-subscriber = { workspace = true }
tree-sitter = { workspace = true }
tree-sitter-go = { workspace = true }
tree-sitter-json = { workspace = true }
tree-sitter-rust = { workspace = true }
tree-sitter-typescript = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion cli/golem-cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use std::process::Command;
static SKIP_ENV_VAR_NAME: &str = "GOLEM_BUILD_SKIP_SHADOW";
const GENERATED_TEMPLATES_DIR_NAME: &str = "templates";
const SKILL_DESTINATION: &str = ".agents/skills";
const SUPPORTED_LANGUAGES: &[&str] = &["ts", "rust", "scala", "moonbit"];
const SUPPORTED_LANGUAGES: &[&str] = &["ts", "rust", "scala", "moonbit", "go"];

fn main() {
generate_embedded_templates().unwrap();
Expand Down
1 change: 1 addition & 0 deletions cli/golem-cli/src/app/build/check/agents.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ mod tests {
GuestLanguage::TypeScript,
GuestLanguage::Rust,
GuestLanguage::MoonBit,
GuestLanguage::Go,
] {
let source = repo
.common_template_file_contents(language, Path::new("AGENTS.md"))
Expand Down
Loading
Loading