Installation¶
Prerequisites¶
- Go 1.21 or later
goimports(optional but recommended — used to sort imports in generated files)
Install via curl (Recommended)¶
Install the pre-built binary with version info stamped via ldflags. Prefer this over go install which rebuilds from source and loses version/commit/buildDate stamping.
Or install a specific version:
The binary is placed in $GOPATH/bin (or $GOBIN if set). Make sure that directory is in your PATH.
Install via go install¶
Note:
go installrebuilds the binary from source. The version will show asv0.0.0 unknown unknownbecause ldflags are not applied duringgo install. Use the curl installer above for release binaries with proper version info.
The binary is placed in $GOPATH/bin (or $GOBIN if set). Make sure that directory is in your PATH.
Build from Source¶
git clone https://github.com/padiazg/go-testgen.git
cd go-testgen
make build # outputs to go-testgen
make install # installs to $GOPATH/bin
Install via Homebrew (macOS and Linux)¶
Homebrew places the binary in its own prefix and adds it to PATH automatically. To upgrade later:
The tap repository is at github.com/padiazg/homebrew-go-testgen.
Verify Installation¶
AI Agent Skills¶
Install go-testgen AI agent skills to guide coding assistants in generating test cases:
Installs closure-check-tests and gen-test-cases skills into ~/.agents/skills/. See AI Agent Skills for usage details.
Optional: Project Configuration File¶
Create .go-testgen.yaml in your project root to control generation behavior. See Configuration for all options.