Prerequisites
Required
Go 1.22+
Download from go.dev/dlVerify:
go versionGit
For cloning the repositoryVerify:
git --versionOptional
- Make - For using Makefile shortcuts (not currently present in repo)
- Yelp API Key - For testing restaurant autocomplete (get one here)
Clone the Repository
Replace
YOUR_USERNAME with the actual repository owner.Build Commands
Development Build
Build for your current platform:toni binary (or toni.exe on Windows) in the current directory.
Run immediately:
Install to GOPATH
Install to$GOPATH/bin (usually ~/go/bin):
~/go/bin is in your $PATH):
Run Without Building
For quick testing during development:Cross-Platform Builds
Build for Multiple Platforms
Go supports cross-compilation viaGOOS and GOARCH environment variables.
CGO_ENABLED=0 is required for cross-compilation. toni uses modernc.org/sqlite (pure Go) specifically to avoid CGO dependencies.Build All Platforms
Create release binaries for all supported platforms:build-all.sh and run:
Build with Version Information
Embed version string at compile time:main.godeclaresvar version = "dev"-ldflags "-X main.version=$VERSION"overrides this at link time- Production builds use git tags:
-X main.version=${RELEASE_TAG}
.github/workflows/release.yml:59
Running Tests
toni currently has no test files. The project prioritizes manual testing in real terminal environments.
When Tests Are Added
Run all tests:Development Workflow
1. Make Changes
Edit source files in your editor of choice. Key directories:internal/ui/- TUI screens and componentsinternal/db/- Database queriesinternal/model/- Domain types and messages
2. Run Locally
~/.toni/toni.db.
3. Check for Errors
Compile check (no build):4. Test in Different Terminals
Important: TUI apps behave differently across terminals! Test in:- iTerm2 (macOS) - True color, Unicode
- Alacritty (Linux/macOS/Windows) - True color, high performance
- Windows Terminal (Windows) - True color, Unicode
- xterm (Linux) - 256-color fallback testing
- Basic terminal - Ensure graceful degradation
Creating Releases
Local Release Build
Automated GitHub Release
toni uses GitHub Actions for automated releases. Trigger a release:
What happens:
- Workflow triggers on
release.publishedevent - Builds matrix of 6 platform combinations
- Each build uses:
- Go 1.23
CGO_ENABLED=0- Version from git tag
- Binaries packaged as
.tar.gz(Unix) or.zip(Windows) - Uploaded to release as downloadable assets
- SHA256 checksums generated and uploaded
.github/workflows/release.yml
Release artifacts:
Troubleshooting
Build Errors
Error:go: cannot find main module
Solution: You’re not in the project root. Run cd to the directory containing go.mod.
Error: package X is not in GOROOT
Solution: Run go mod download to fetch dependencies.
Error: undefined: sqlite
Solution: Ensure modernc.org/sqlite is in go.mod. Run go mod tidy.
Cross-Compilation Errors
Error:cgo is not supported
Solution: Set CGO_ENABLED=0 when cross-compiling:
- Correct
GOOSandGOARCHfor target - Binary has execute permissions:
chmod +x toni - Target platform architecture matches build
Runtime Issues
Database errors on startup Solution: Ensure write permissions on~/.toni/ directory:
- Terminal size ≥ 72×18:
echo $COLUMNS $LINES TERMenvironment variable set:echo $TERM- Try forcing color mode:
export COLORTERM=truecolor
- Yelp API key set:
echo $YELP_API_KEY - Network connectivity to
api.yelp.com - API key validity at Yelp developer dashboard
Build Optimization
Reduce Binary Size
Strip debug symbols:-s: Omit symbol table-w: Omit DWARF debug info
UPX compression can trigger false positives in antivirus software. Use with caution for distributed binaries.
Faster Builds
Enable build cache (on by default since Go 1.10):Next Steps
After building:- Try it out: Run
./toniand explore the interface - Read the code: Start with
main.go, theninternal/ui/app.go - Make changes: Add a feature or fix a bug
- Share: Create a pull request with your improvements