-
Notifications
You must be signed in to change notification settings - Fork 1
Development Guide
This guide covers building, testing, and releasing dot2net for developers and contributors.
- Go: Version 1.21 or later (1.23+ recommended)
- Git: For version control
- Docker (optional): For containerized builds
Build the binary in the project root directory:
go build .This creates a dot2net executable in the current directory.
For reproducible builds without installing Go locally:
docker run --rm -v $PWD:/v -w /v golang:1.23 go build -buildvcs=false .Note: The -buildvcs=false flag is required because the Docker container cannot access the .git directory properly.
Go supports cross-compilation via environment variables:
# Linux (amd64)
GOOS=linux GOARCH=amd64 go build -o dot2net-linux-amd64 .
# macOS (Apple Silicon)
GOOS=darwin GOARCH=arm64 go build -o dot2net-darwin-arm64 .
# macOS (Intel)
GOOS=darwin GOARCH=amd64 go build -o dot2net-darwin-amd64 .go test -v ./...# Test a specific package
go test -v ./pkg/model
go test -v ./internal/test
# Run a specific test function
go test -v ./pkg/model -run TestLoadConfigThe internal/test/example_test.go file runs tests against all example scenarios in the example/ directory. Each scenario compares generated output against expected files in expected/ subdirectories.
When you intentionally change output behavior, update the expected values:
# Update all scenarios
./tool/generate_expected.sh
# Update a specific scenario
./tool/generate_expected.sh scenario_nameThe project uses GitHub Actions for automated testing and releases. The workflow is defined in .github/workflows/release.yaml.
The workflow runs when a version tag is pushed:
git tag v0.7.0
git push origin v0.7.0Tag format must match v[0-9]+.[0-9]+.[0-9]+ (e.g., v0.6.2, v1.0.0).
-
Test: Run tests on multiple platforms
- Linux (ubuntu-latest)
- macOS ARM (macos-latest)
- macOS Intel (macos-15-intel)
-
Build: Cross-compile binaries for:
linux-amd64linux-arm64darwin-amd64darwin-arm64
-
Release: Create a GitHub Release with binaries attached
- Actions tab: https://github.com/cpflat/dot2net/actions
- Releases page: https://github.com/cpflat/dot2net/releases
Edit main.go and update the Version variable:
var (
Version = "0.7.0"
)Add a new section to CHANGELOG.md:
## [0.7.0] - YYYY-MM-DD
### Added
- New feature description
### Changed
- Change description
### Fixed
- Bug fix descriptionDon't forget to update the comparison links at the bottom of the file.
git add main.go CHANGELOG.md
git commit -m "v0.7.0; description of changes"
git push origin mastergit tag v0.7.0
git push origin v0.7.0This triggers the GitHub Actions workflow, which automatically:
- Runs tests
- Builds binaries
- Creates a GitHub Release
- Uploads binaries to the release
Check the Releases page to confirm:
- Release was created
- All binaries are attached
- Release notes are correct
# Linux (amd64)
curl -L -o dot2net https://github.com/cpflat/dot2net/releases/latest/download/dot2net-linux-amd64
chmod +x dot2net
# macOS (Apple Silicon)
curl -L -o dot2net https://github.com/cpflat/dot2net/releases/latest/download/dot2net-darwin-arm64
chmod +x dot2netcurl -L -o dot2net https://github.com/cpflat/dot2net/releases/download/v0.6.2/dot2net-linux-amd64Windows is currently not supported in CI/CD due to CRLF line ending issues in tests. See TODO 16 for details.
If you need Windows builds, you can cross-compile locally:
GOOS=windows GOARCH=amd64 go build -o dot2net.exe .- Command Reference - CLI usage
- FormatStyle Design - Internal formatting system