Thank you for your interest in contributing to go-binspect! This document provides guidelines and instructions for contributing.
Be respectful and inclusive. We welcome contributions from everyone.
If you find a bug, please open an issue with:
- A clear description of the problem
- Steps to reproduce
- Expected behavior
- Actual behavior
- Sample file (if applicable)
- Your operating system and Go version
We welcome feature suggestions! Please open an issue with:
- A clear description of the feature
- Use cases and benefits
- Any implementation ideas you have
-
Fork the repository
-
Create a feature branch
git checkout -b feature/your-feature-name
-
Make your changes
- Follow the existing code style
- Add tests for new functionality
- Update documentation as needed
-
Run tests
make test -
Commit your changes
git commit -m "Add: Brief description of your changes" -
Push to your fork
git push origin feature/your-feature-name
-
Open a Pull Request
- Go 1.21 or later (tested with Go 1.24)
- Git
# Clone the repository
git clone https://github.com/BaseMax/go-binspect.git
cd go-binspect
# Install dependencies
make deps
# Build the project
make build
# Run tests
make testgo-binspect/
├── cmd/binspect/ # Main application
├── internal/
│ ├── parser/ # File format parsers
│ ├── reader/ # Binary reading utilities
│ └── ui/ # TUI components
├── examples/ # Example outputs
└── README.md
To add support for a new file format:
-
Create a new parser file in
internal/parser/:// internal/parser/myformat.go package parser type MyFormatParser struct{} func NewMyFormatParser() *MyFormatParser { return &MyFormatParser{} } func (p *MyFormatParser) GetName() string { return "MyFormat" } func (p *MyFormatParser) Detect(data []byte) bool { // Implement format detection logic return false } func (p *MyFormatParser) Parse(reader interface{}) (*FileInfo, error) { // Implement parsing logic return nil, nil }
-
Add tests in
internal/parser/myformat_test.go -
Register the parser in
cmd/binspect/main.go:registry.Register(parser.NewMyFormatParser())
-
Update documentation in README.md
- Follow standard Go formatting (
gofmt) - Use meaningful variable names
- Add comments for exported functions
- Keep functions focused and small
- Write tests for new functionality
- All new code should have tests
- Tests should be in
*_test.gofiles - Run tests with
make test - Aim for good test coverage
func TestMyParser_Detect(t *testing.T) {
parser := NewMyParser()
validData := []byte{...}
if !parser.Detect(validData) {
t.Error("Expected parser to detect valid file")
}
invalidData := []byte{...}
if parser.Detect(invalidData) {
t.Error("Expected parser to reject invalid file")
}
}- Update README.md for user-facing changes
- Add examples to examples/ directory
- Document new parsers and features
- Keep comments up to date
- Keep PRs focused on a single feature or fix
- Write clear commit messages
- Update tests and documentation
- Ensure all tests pass
- Respond to review feedback
Add: Support for WASM binary format
Fix: Incorrect offset calculation in PE parser
Update: Improve hex view performance
Docs: Add examples for Mach-O format
If you have questions, feel free to:
- Open an issue for discussion
- Reach out to the maintainers
By contributing, you agree that your contributions will be licensed under the GPL-3.0 License.