bd
is a simple tool for managing Go binary dependencies. It allows you to specify the required tools, their versions, and target installation directory in a configuration file (bd.json
).
- Ensures consistent versions of binaries across environments.
- Installs binaries to a dedicated directory, preventing pollution of global
GOBIN
. - Supports custom binary names with version suffixes.
- Avoids dependency conflicts often encountered with
tools.go
. - Provides an easy way to execute installed binaries with
bd exec
.
# Clone the repository and build manually, or install using go install
go install github.com/afansv/bd@latest
{
"binDir": "bin",
"binaries": [
{ "package": "golang.org/x/tools/cmd/goimports", "version": "latest", "name": "goimports" },
{ "package": "github.com/mgechev/revive", "version": "v1.3.0", "name": "revive" }
]
}
Note: It is recommended to specify exact versions instead of
latest
to ensure reproducible environments.
bd install
This will install the specified binaries into binDir
, appending their versions to the filenames.
Note: You can use
--clean
,-clean
or-c
option to cleanbinDir
before installing.
bd exec goimports -w main.go
If the binary is not found, bd
will suggest running bd install
first.
Alternatively, you can run binaries directly from binDir
:
./bin/goimports -w main.go
- Keeps your project’s tooling self-contained, avoiding version conflicts.
- Works without modifying
go.mod
or relying ontools.go
. - Ensures team-wide consistency in CI/CD and local development.
- Store
bd.json
in the repository. It should not be added to.gitignore
. - The
binDir
directory should be added to.gitignore
to avoid committing installed binaries.
MIT