ITADN

Go toolchain plugin fails to parse tool directives in go.mod

#148Closedcedws 创建于 2026-06-09
C
cedwscommented
## Summary The Go toolchain plugin throws a WASM parse error when a `go.mod` contains a [`tool`](https://go.dev/ref/mod#go-mod-file-tool) directive (Go 1.24+). This is a **regression**: `go_toolchain-v1.2.0` parses it correctly, but **v1.3.0 and v1.4.0 fail**. This is the same symptom as the previously-fixed [moonrepo/moon#2130](https://github.com/moonrepo/moon/issues/2130) ("golang plugin does not support `tool` section"), which was resolved in moon 1.40.5 — it appears to have been reintroduced. ## Error ``` Error: plugin::wasm::failed_function_call × parse error at line 166, column 1 │ | │ 166 | github.com/pressly/goose/v3/cmd/goose │ | ^ ``` The reported line/column points at the first entry inside the `tool (...)` block. ## Steps to reproduce 1. Use a `go.mod` (Go 1.24+) containing a multi-line `tool` directive: ``` tool ( github.com/pressly/goose/v3/cmd/goose github.com/sqlc-dev/sqlc/cmd/sqlc ) ``` 2. Pin the Go toolchain plugin to v1.3.0 or v1.4.0 in `.moon/toolchains.yml`: ```yaml go: plugin: "https://github.com/moonrepo/plugins/releases/download/go_toolchain-v1.4.0/go_toolchain.wasm" ``` 3. Run any command that builds the project graph, e.g. `moon sync projects`. ## Expected behaviour The `tool` directive is parsed without error and project sync succeeds (as it does with `go_toolchain-v1.2.0`). ## Actual behaviour `plugin::wasm::failed_function_call` parse error on the first line inside the `tool` block; the command aborts. ## Regression range | `go_toolchain` version | Result | | --- | --- | | v1.2.0 | ✅ parses correctly | | v1.3.0 | ❌ parse error | | v1.4.0 | ❌ parse error | v1.3.0 is the release that [added support for the Go 1.24 `ignore` directive](https://github.com/moonrepo/plugins/releases/tag/go_toolchain-v1.3.0), which looks like the likely point of regression in the `go.mod` parser. ## Workaround Pin the plugin back to v1.2.0: ```yaml go: plugin: "https://github.com/moonrepo/plugins/releases/download/go_toolchain-v1.2.0/go_toolchain.wasm" ``` ## Environment - moon: 2.3.2 - go_toolchain plugin: v1.3.0 and v1.4.0 (broken), v1.2.0 (works) - Go: 1.26.3 - OS: macOS (Darwin 25.5.0, arm64)
关闭于 2026-06-10 2 条评论