Skip to content

Commit c398cfe

Browse files
committed
Add go config docs.
1 parent ea6cd41 commit c398cfe

2 files changed

Lines changed: 82 additions & 0 deletions

File tree

website/blog/2025-06-23_moon-v1.38.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ Additionally, the following features and functionality is available when enablin
4747
- Automatically runs `go mod` or `go work` commands when installing dependencies.
4848
- Basic Docker image and pruning support.
4949

50+
We hope you enjoy this new Go toolchain. With that said, we are not Go experts, and would love to
51+
hear from you on what works, what doesn't, what can be improved, and what features you would like to
52+
see added!
53+
5054
## Other changes
5155

5256
View the [official release](https://github.com/moonrepo/moon/releases/tag/v1.38.0) for a full list

website/docs/config/toolchain.mdx

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,84 @@ moon:
7575
downloadUrl: 'https://github.com/moonrepo/moon/releases/latest/download'
7676
```
7777

78+
## Go
79+
80+
## `unstable_go`<VersionLabel version="1.38.0" />
81+
82+
<HeadingApiLink to="/api/types/interface/ToolchainConfig#go" />
83+
84+
Enables and configures Go. This setting enables the new WASM powered Go toolchain.
85+
86+
### `version`
87+
88+
<HeadingApiLink to="/api/types/interface/GoConfig#version" />
89+
90+
Defines the explicit Go toolchain
91+
[version specification](../concepts/toolchain#version-specification) to use. If this field is _not
92+
defined_, the global `go` binary will be used.
93+
94+
```yaml title=".moon/toolchain.yml" {2}
95+
unstable_go:
96+
version: '1.24.0'
97+
```
98+
99+
> Version can also be defined with [`.prototools`](../proto/config).
100+
101+
### `bins`
102+
103+
<HeadingApiLink to="/api/types/interface/GoConfig#bins" />
104+
105+
A list of binaries to install globally into Go (`~/go/bin`) using `go install`. This setting
106+
requires a list of URLs or binary configuration objects with the following fields:
107+
108+
- `bin` (required) - URL of the binary.
109+
- `local` - Only install the binary locally, and not in CI.
110+
111+
```yaml title=".moon/toolchain.yml" {2-5}
112+
unstable_go:
113+
bins:
114+
- 'golang.org/x/tools/gopls'
115+
- bin: 'github.com/revel/cmd/revel@1'
116+
local: true
117+
```
118+
119+
### `tidyOnChange`
120+
121+
<HeadingApiLink to="/api/types/interface/GoConfig#tidyOnChange" />
122+
123+
Tidy modules when dependencies or `go.sum` changes by running `go mod tidy`. This setting is ignored
124+
when using Go workspaces. Defaults to `false`.
125+
126+
```yaml title=".moon/toolchain.yml" {2}
127+
unstable_go:
128+
tidyOnChange: true
129+
```
130+
131+
### `vendorDir`
132+
133+
<HeadingApiLink to="/api/types/interface/GoConfig#vendorDir" />
134+
135+
A relative path to the vendor directory from the dependencies root, as generated with
136+
`go mod vendor`. If vendored with the default name of "vendor", this setting can be omitted.
137+
138+
```yaml title=".moon/toolchain.yml" {2}
139+
unstable_go:
140+
vendorDir: 'custom/vendor/path'
141+
```
142+
143+
### `workspaces`
144+
145+
<HeadingApiLink to="/api/types/interface/GoConfig#workspaces" />
146+
147+
Enables support for [Go workspaces](https://go.dev/ref/mod#workspaces) and will attempt to locate
148+
the dependencies root by locating the `go.work` file, and parsing `go.work.sum` files. This
149+
functionality will take precedence over `go.sum` files. Defaults to `true`.
150+
151+
```yaml title=".moon/toolchain.yml" {2}
152+
unstable_go:
153+
workspaces: true
154+
```
155+
78156
## JavaScript
79157

80158
## `bun`<VersionLabel version="1.17.0" />

0 commit comments

Comments
 (0)