Development Setup
Prerequisites
- Go 1.24 or later
- Git
- (Optional) golangci-lint for local linting
Getting Started
Project Structure
Running Tests
Fast Tests (Recommended for Development)
Use-short flag to skip slow integration tests:
Full Test Suite
Run before committing to ensure nothing breaks:We use a two-tier testing approach:
- Fast tests (~2s): Run on every PR via CI with
-shortflag - Slow tests (~14s): Run nightly with full git operations
When to Use Each
Use-short for:
- Active development for fast feedback loops
- Small changes that don’t affect integration points
- Quick verification that unit tests pass
- Before committing and pushing changes
- After modifying git operations or multi-clone scenarios
- Preparing a pull request
Code Style
We follow standard Go conventions:- Use
gofmtto format your code (runs automatically in most editors) - Follow the Effective Go guidelines
- Keep functions small and focused
- Write clear, descriptive variable names
- Add comments for exported functions and types
Linting
We use golangci-lint for code quality checks:The linter currently reports ~100 warnings. These are documented false positives and idiomatic Go patterns (deferred cleanup, Cobra interface requirements, etc.). When contributing, focus on avoiding new issues rather than the baseline warnings.
Making Changes
Workflow
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature - Make your changes
- Add tests for new functionality
- Run tests and linter locally
- Commit your changes with clear messages
- Push to your fork
- Open a pull request
Commit Messages
Write clear, concise commit messages:Pull Requests
- Keep PRs focused on a single feature or fix
- Include tests for new functionality
- Update documentation as needed
- Ensure CI passes before requesting review
- Respond to review feedback promptly
Testing Guidelines
Dual-Mode Testing Pattern
Use the dual-mode test framework for testing commands:CreateIssue(issue)- Create an issueGetIssue(id)- Retrieve an issue by IDUpdateIssue(id, updates)- Update issue fieldsDeleteIssue(id, force)- Delete (tombstone) an issueAddDependency(from, to, type)- Add a dependencyListIssues(filter)- List issues matching filterGetReadyWork()- Get issues ready for workAddLabel(id, label)- Add a label to an issueMode()- Returns “embedded” or “server” for error messages
Writing Tests
- Write table-driven tests when testing multiple scenarios
- Use descriptive test names that explain what is being tested
- Clean up resources (database files, etc.) in test teardown
- Use
t.Run()for subtests to organize related test cases - Mark slow tests with
if testing.Short() { t.Skip("slow test") }
Documentation
- Update README.md for user-facing changes
- Update relevant .md files in the project root
- Add inline code comments for complex logic
- Include examples in documentation
Feature Requests and Bug Reports
Reporting Bugs
Include in your bug report:- Steps to reproduce
- Expected behavior
- Actual behavior
- Version of bd (
bd version) - Operating system and Go version
Feature Requests
When proposing new features:- Explain the use case
- Describe the proposed solution
- Consider backwards compatibility
- Discuss alternatives you’ve considered
Code Review Process
All contributions go through code review:- Automated checks (tests, linting) must pass
- At least one maintainer approval required
- Address review feedback
- Maintainer will merge when ready
Development Tips
Testing Locally
Database Inspection
Updating Nix flake.lock
Whengo.mod bumps the Go version beyond what’s in the pinned nixpkgs, update flake.lock using Docker:
Debugging
Use Go’s built-in debugging tools:Release Process
(For maintainers)- Update version in code
- Update CHANGELOG.md
- Tag release:
git tag v0.x.0 - Push tag:
git push origin v0.x.0 - GitHub Actions will build and publish
Questions?
License
By contributing, you agree that your contributions will be licensed under the MIT License.Code of Conduct
Be respectful and professional in all interactions. We’re here to build something great together.Thank you for contributing to bd!