Running Go build, test and fmt commands from one file with 1build

1build is a small command-line tool that stores a project’s commands in a 1build.yaml file and runs them by name. Instead of remembering go build -o bin/app . or go test -race ./..., everyone on the team runs 1build build or 1build test. It is language-agnostic; this post uses a Go project as the example.
Install
Section titled “Install”With Homebrew:
brew tap gopinath-langote/one-buildbrew install one-buildOtherwise, download a binary from the latest release and put it on your PATH. Check it works:
1build --versionA minimal Go project
Section titled “A minimal Go project”mkdir my-go-projectcd my-go-projectgo mod init example.com/my-go-projectAdd a main.go:
package main
import "fmt"
func main() { fmt.Println("Hello, 1build!")}The 1build.yaml file
Section titled “The 1build.yaml file”Generate a starter file with 1build init:
1build init --name "my-go-project"Then edit 1build.yaml. Each entry under commands maps a name to the shell command it runs:
project: my-go-projectcommands: - build: go build -o my-app . - test: go test ./... - fmt: go fmt ./... - run: ./my-appYou can also add or remove commands from the CLI instead of editing the file by hand:
1build set vet "go vet ./..."1build unset vetRunning commands
Section titled “Running commands”Run a command by its name:
1build buildYou can pass several names in one call:
1build fmt build runAdd --quiet (or -q) to print only SUCCESS or FAILURE instead of the command output, which is handy in CI logs.
Before and after hooks
Section titled “Before and after hooks”The optional before and after keys run around your commands, for example to set and clear an environment variable or start and stop a local database:
project: my-go-projectbefore: export CGO_ENABLED=0after: unset CGO_ENABLEDcommands: - build: go build -o my-app .They can also be set with 1build set before '...' and removed with 1build unset before after.
When a Makefile is the better choice
Section titled “When a Makefile is the better choice”1build only maps names to commands. It has no dependencies between targets and no “only rebuild if inputs changed” logic, and every contributor has to install it. If your project already has a Makefile or Taskfile, or you need targets that depend on each other, stick with those. 1build fits best when you want a short, readable list of commands with nothing else to learn.
Further reading
Section titled “Further reading”© 2026 David Li · Home · Blog · RSS ·Classic site · Built with Astro, Starlight and three.js · Logos:Font Awesome Free (CC BY 4.0)