Skip to content

Latest commit

 

History

History
166 lines (120 loc) · 3.94 KB

File metadata and controls

166 lines (120 loc) · 3.94 KB

Contributing to go-config-diff

Thank you for your interest in contributing to go-config-diff! This document provides guidelines and instructions for contributing.

Getting Started

  1. Fork the repository
  2. Clone your fork: git clone https://github.com/YOUR_USERNAME/go-config-diff.git
  3. Create a feature branch: git checkout -b feature/your-feature-name
  4. Make your changes
  5. Run tests: make test
  6. Commit your changes: git commit -am 'Add some feature'
  7. Push to the branch: git push origin feature/your-feature-name
  8. Create a Pull Request

Development Setup

Prerequisites

  • Go 1.24 or later
  • Make (optional, for using Makefile targets)

Building

make build

Running Tests

make test

Running the Tool

make run

Code Style

  • Follow standard Go conventions
  • Use gofmt to format your code
  • Write meaningful commit messages
  • Add comments for complex logic
  • Keep functions focused and small

Testing

  • Write tests for new features
  • Ensure all tests pass before submitting PR
  • Add test cases for edge cases
  • Update existing tests if behavior changes

Test Structure

pkg/
  ast/
    ast.go
    ast_test.go      # Tests for AST functionality
  parser/
    parser.go
    parser_test.go   # Tests for parsers
  diff/
    diff.go
    diff_test.go     # Tests for diff logic

Adding a New Format

To add support for a new configuration format:

  1. Add the format constant to pkg/parser/parser.go:

    const FormatXML Format = "xml"
  2. Update DetectFormat() to recognize the file extension

  3. Implement a parser function:

    func parseXML(r io.Reader) (interface{}, error) {
        // Parse XML and return as interface{}
    }
  4. Add the case to ParseReader() switch statement

  5. Add tests in pkg/parser/parser_test.go

  6. Add example files in examples/ directory

  7. Update documentation

Pull Request Guidelines

  • Title: Use a clear, descriptive title
  • Description: Explain what changes you made and why
  • Tests: Include tests for new functionality
  • Documentation: Update README or other docs if needed
  • One feature per PR: Keep PRs focused on a single feature or fix

Reporting Issues

When reporting issues, please include:

  • Go version: go version
  • Operating system and version
  • Clear description of the problem
  • Steps to reproduce
  • Expected vs actual behavior
  • Error messages or logs
  • Sample configuration files (if applicable)

Feature Requests

We welcome feature requests! Please:

  • Check if the feature already exists
  • Search existing issues for similar requests
  • Provide a clear use case
  • Explain why the feature would be valuable

Code Review Process

  1. All PRs require review before merging
  2. Address review comments
  3. Keep the discussion constructive and professional
  4. PRs may be updated by maintainers to fix minor issues

Project Structure

go-config-diff/
├── cmd/
│   └── go-config-diff/    # CLI entry point
├── pkg/
│   ├── ast/               # Abstract Syntax Tree
│   ├── parser/            # Format parsers
│   ├── diff/              # Comparison logic
│   └── output/            # Output formatters
├── examples/              # Example config files
├── Makefile               # Build automation
└── README.md              # Documentation

Areas for Contribution

  • New format support: Add XML, HOCON, or other formats
  • Output formats: Add more output options (HTML, Markdown, etc.)
  • Performance: Optimize comparison for large files
  • Documentation: Improve examples and guides
  • Tests: Add more test coverage
  • Bug fixes: Fix reported issues

Questions?

Feel free to open an issue with your question or reach out to the maintainers.

License

By contributing, you agree that your contributions will be licensed under the GPL-3.0 License.

Thank you for contributing to go-config-diff! 🎉