Skip to main content

Prerequisites

Before building FG Character Extractor, ensure you have the following installed:

Go 1.25.7+

Download from go.dev

Task

Install from taskfile.dev
Optional: devbox provides a consistent development environment. Install with:
curl -fsSL https://get.jetpack.io/devbox/install.sh | bash

Building for Your Platform

The project uses Task for build automation. All build outputs are placed in the dist/ directory.
1

Navigate to the project directory

cd ~/workspace/source
2

Build for your current platform

task build
This creates dist/fg-char-extract for your current OS and architecture.
3

Run the binary

./dist/fg-char-extract path/to/db.xml

Cross-Platform Builds

Build for all supported platforms in one command:
task build-all
This produces binaries for:
  • macOS Intel (darwin/amd64): dist/fg-char-extract-darwin-amd64
  • macOS Apple Silicon (darwin/arm64): dist/fg-char-extract-darwin-arm64
  • Windows (windows/amd64): dist/fg-char-extract-windows-amd64.exe
The build-all task automatically runs clean first to ensure a fresh build.

Available Task Commands

The project’s Taskfile.yml defines several useful commands:
Build the application for your current platform only. Creates dist/fg-char-extract.Includes source tracking - only rebuilds if *.go files have changed.
Build for all supported platforms (macOS amd64/arm64, Windows amd64).Automatically cleans the dist/ directory first.
Quick test run against the test database:
task run
Equivalent to: go run main.go ./tests/db.xml
Run the full test suite:
task test
See Testing for more details.
Remove build artifacts and generated files:
task clean
Deletes:
  • dist/ directory (all binaries)
  • character_*.xml (generated output files)

Building for a Specific Platform

While not exposed as a public task, you can build for a specific platform using Go’s cross-compilation:
GOOS=darwin GOARCH=amd64 go build -o dist/fg-char-extract-darwin-amd64 main.go

Development with Devbox

Devbox provides an isolated, reproducible development environment. The project includes devbox configuration for consistent builds.
1

Enter the devbox shell

cd ~/workspace/source
devbox shell
2

Build with devbox

devbox run -- task build-all
All dependencies (Go, Task) are automatically available in the devbox environment without affecting your system installation.

Output Structure

After building, your directory structure will look like:
fg-char-extract/
├── dist/
│   ├── fg-char-extract                    # Current platform
│   ├── fg-char-extract-darwin-amd64       # macOS Intel
│   ├── fg-char-extract-darwin-arm64       # macOS Apple Silicon
│   └── fg-char-extract-windows-amd64.exe  # Windows
├── main.go
├── main_test.go
└── Taskfile.yml

Build Troubleshooting

The project requires Go 1.25.7 or higher. Check your version:
go version
If needed, download the latest version from go.dev.
Install Task from taskfile.dev:
# macOS
brew install go-task

# Linux
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin
Clear Go’s build cache and start fresh:
task clean
go clean -cache
task build

Next Steps

Testing

Learn how to run tests and add new test cases

Contributing

Read the contribution guidelines before submitting changes

Build docs developers (and LLMs) love