Thank you for your interest in contributing to mockd! This document provides guidelines and instructions for contributing.
- Go 1.25 or later
- Git
- Fork the repository
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/mockd.git cd mockd - Add the upstream remote:
git remote add upstream https://github.com/getmockd/mockd.git
go build ./...Run the full test suite with race detection:
go test -race ./...Run with coverage:
go test -race -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.htmlRun specific test packages:
go test -v ./pkg/engine/...
go test -v ./tests/integration/...go test -bench=. -benchmem ./tests/performance/...- Follow standard Go conventions and idioms
- Run
go fmtbefore committing - Run
go vetto check for issues - Keep the stdlib-only approach - no external dependencies in core packages
- Use
testifyfor test assertions (testing only)
mockd/
├── pkg/
│ ├── admin/ # REST admin API
│ ├── config/ # Configuration types and file I/O
│ ├── engine/ # Core mock server engine
│ └── tls/ # TLS certificate generation
└── tests/
├── integration/ # Integration tests
└── performance/ # Benchmark tests
feature/description- New featuresfix/description- Bug fixesdocs/description- Documentation changesrefactor/description- Code refactoring
Write clear, descriptive commit messages:
- Use present tense ("Add feature" not "Added feature")
- Use imperative mood ("Fix bug" not "Fixes bug")
- Keep the first line under 72 characters
- Reference issues when applicable
- Create a branch for your changes
- Make your changes with tests
- Run the full test suite
- Update documentation if needed
- Submit a pull request
All submissions require review. Expect feedback on:
- Code correctness and test coverage
- Performance implications
- API design and backwards compatibility
- Documentation completeness
- Place unit tests alongside the code they test (
*_test.go) - Test both success and error cases
- Use table-driven tests for multiple scenarios
- Place integration tests in
tests/integration/ - Use dynamic port allocation to avoid conflicts
- Clean up resources after tests
- Place benchmarks in
tests/performance/ - Include memory allocation metrics
- Document performance expectations
When reporting issues, please include:
- Go version (
go version) - Operating system
- Steps to reproduce
- Expected vs actual behavior
- Relevant logs or error messages
Feature requests are welcome! Please describe:
- The problem you're trying to solve
- Your proposed solution
- Any alternatives you've considered
By contributing, you agree that your contributions will be licensed under the Apache License 2.0.