go_run
go_run invokes go run <package>@<version> <args...> with the managed SDK. Use it for a versioned Go command that does not need to become available to another task. It registers the command as a root task and returns its dependency.
Arguments
| Argument | Required | Description |
|---|---|---|
package | Yes | Non-empty Go package path without an @version suffix. |
version | Yes | Non-empty Go version query appended to the package path. |
args | No | String arguments passed to the Go command. Defaults to []. |
deps | No | Dependencies activated before running the command, in list order. Defaults to []. |
Examples
Run a tool
load("@[email protected]", "go_run")
go_run(
package="codeberg.org/tsukinoko-kun/doctopus",
version="latest",
args=["build"],
)
Run a pinned generator with configuration
load("@[email protected]", "go_run")
load("@os@1", "env_set")
go_run(
package="github.com/sqlc-dev/sqlc/cmd/sqlc",
version="v1.29.0",
args=["generate"],
deps=[env_set("GOWORK", "off")],
)