Thank you for your interest in contributing to the CoT Library for Go! This document provides guidelines and instructions for contributing.
This project adheres to a standard code of conduct. By participating, you are expected to:
- Be respectful and inclusive
- Focus on constructive feedback
- Maintain professional discourse
- Support a welcoming environment
-
Fork the Repository
- Create your own fork of the code
- Clone your fork locally
-
Set Up Development Environment
git clone https://github.com/YOUR-USERNAME/cotlib.git cd cotlib go mod download -
Create a Branch
git checkout -b feature/your-feature-name
- Follow standard Go conventions
- Use
gofmtto format code - Follow the project's existing patterns
- Document all exported symbols
- Use meaningful variable and function names
-
Test Organization
- Integration tests go in
integration_test.go - Internal tests go in
internal/internal_test.go - Examples go in
examples_test.go
- Integration tests go in
-
Test Requirements
- Write tests for all new features
- Maintain existing test coverage
- Include both positive and negative test cases
- Test edge cases thoroughly
-
Running Tests
go test -v ./... -
Running Benchmarks
go test -bench .
- Use
slogfor all logging - Follow the established logging patterns:
logger.Debug("detailed state", "key1", value1, "key2", value2) logger.Info("operational message", "key", value) logger.Warn("unexpected condition", "error", err) logger.Error("critical problem", "error", err)
- Never store sensitive data in logs
- Always validate input
- Use secure XML parsing
- Consider security implications of changes
- Document security considerations
-
Before Submitting
- Update documentation
- Add/update tests
- Run all tests
- Format code with
gofmt - Update README.md if needed
-
Pull Request Content
- Provide a clear description
- Reference any related issues
- List notable changes
- Include testing steps
- Note any breaking changes
-
Review Process
- Address review feedback
- Keep discussions focused
- Be patient and responsive
Follow these guidelines for commit messages:
type(scope): Brief description
Detailed description of changes and rationale.
Fixes #123
Types:
- feat: New feature
- fix: Bug fix
- docs: Documentation changes
- style: Formatting changes
- refactor: Code restructuring
- test: Test changes
- chore: Maintenance tasks
- Update README.md for significant changes
- Document all new features
- Include examples for new functionality
- Keep documentation current
- Use clear, concise language
-
Version Numbers
- Follow semantic versioning (MAJOR.MINOR.PATCH)
- Document breaking changes
-
Release Notes
- List significant changes
- Note any deprecations
- Include upgrade instructions
- Open an issue for general questions
- Tag security issues appropriately
- Use discussions for design proposals
By contributing, you agree that your contributions will be licensed under the project's MIT License.