Skip to content

shagohead/gotools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

gotools

Tiny (without dependencies) go run package@version alternative that pre-installs binaries into (project) local directory. This eliminates waiting of tools building on every go generate call (gotools itself builds relatively fast).

Why not use «tools.go» approach which tracks apps versions in go.mod? Because in that way tools dependencies becomes project dependencies and affects project's dependency graph and vice versa: your project dependencies affects tools dependencies, and even more: tools affects each other dependencies. This is wrong, because and your project and each tool should have their own dependencies isolated from others.

Usage

When gotools invoked it searches for go.tools file in current working directory or in one of it parents. It makes sense to store go.tools in the same directory as go.mod and go.sum. go.tools content example:

github.com/ogen-go/ogen/cmd/[email protected]
github.com/sqlc-dev/sqlc/cmd/[email protected]

Use these tools with gotools like this:

//go:generate go run github.com/shagohead/[email protected] ogen -target=client -package=client -clean openapi.yaml
//go:generate go run github.com/shagohead/[email protected] sqlc generate