Skip to content

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.

With Homebrew:

Terminal window
brew tap gopinath-langote/one-build
brew install one-build

Otherwise, download a binary from the latest release and put it on your PATH. Check it works:

Terminal window
1build --version
Terminal window
mkdir my-go-project
cd my-go-project
go mod init example.com/my-go-project

Add a main.go:

package main
import "fmt"
func main() {
fmt.Println("Hello, 1build!")
}

Generate a starter file with 1build init:

Terminal window
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-project
commands:
- build: go build -o my-app .
- test: go test ./...
- fmt: go fmt ./...
- run: ./my-app

You can also add or remove commands from the CLI instead of editing the file by hand:

Terminal window
1build set vet "go vet ./..."
1build unset vet

Run a command by its name:

Terminal window
1build build

You can pass several names in one call:

Terminal window
1build fmt build run

Add --quiet (or -q) to print only SUCCESS or FAILURE instead of the command output, which is handy in CI logs.

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-project
before: export CGO_ENABLED=0
after: unset CGO_ENABLED
commands:
- build: go build -o my-app .

They can also be set with 1build set before '...' and removed with 1build unset before after.

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.

© 2026 David Li · Home · Blog · RSS ·Classic site · Built with Astro, Starlight and three.js · Logos:Font Awesome Free (CC BY 4.0)