Thank you for your interest in contributing to go-netconf! This document provides guidelines for contributing to the project.
This project adheres to a Code of Conduct. By participating, you are expected to uphold this code.
Before creating bug reports, please check existing issues to avoid duplicates. Include:
- Clear title and description with steps to reproduce
- Expected vs actual behavior with code samples
- Go version, OS information, device type/version
- NETCONF capabilities supported by the device
Feature suggestions are welcome! Please:
- Check existing feature requests to avoid duplicates
- Provide clear use cases and explain why it's useful
- Consider RFC compliance (RFC 6241, 6242) and device compatibility
- Consider implementation complexity and security implications
- Fork the repository and create a branch from
main - Make your changes following the coding guidelines below
- Add tests for any new functionality
- Add SPDX headers to new Go files - see Headers section (contributors: add manually with YOUR copyright, do NOT run
make license) - Ensure all checks pass:
make test,make lint,make security - Update documentation as needed
- Write clear commit messages following conventional commits
- Submit a pull request
# Clone your fork
git clone https://github.com/YOUR-USERNAME/go-netconf.git
cd go-netconf
# Install dependencies
go mod download
# Run all checks
make verifyPrerequisites: Go 1.24+, golangci-lint, Make (optional)
- Follow Effective Go and Go Code Review Comments
- Use
go fmtfor formatting - Write clear comments for exported functions
- Follow NETCONF terminology from RFC 6241
All Go source files must include SPDX license identifier and copyright notice:
// SPDX-License-Identifier: MPL-2.0
// Copyright (c) 2025 Daniel Schmidt
package netconfThe project uses Google's addlicense tool for license header management.
Install addlicense:
go install github.com/google/addlicense@v1.1.1
# Or use: make toolsVersion Note: Use the exact version shown above (@v1.1.1) to match the CI environment. Using @latest may cause version mismatches between local development and CI checks.
Add headers to new files:
make licenseVerify headers:
make check-licenseImportant Notes:
- For Maintainers: Use
make licenseto add headers with project default copyright holder - For Contributors: Do NOT use
make license- it will overwrite your copyright holder - For Contributors: Manually add headers to new files with YOUR organization's copyright:
// SPDX-License-Identifier: MPL-2.0 // Copyright (c) 2025 Your Organization Name package netconf
- Then run
make check-licenseto verify format compliance (accepts any copyright holder) - Both SPDX-first and Copyright-first formats are accepted by the check command
- Write unit tests for all new functionality
- Use table-driven tests with edge cases and error conditions
- Test with mock NETCONF sessions for unit tests
- Add integration tests for device compatibility
- Run race detector:
go test -race
Test all code for security vulnerabilities:
- Lock management: Ensure defer unlock is always used
- Input validation: Test malformed XML, oversized payloads, invalid characters
- Error handling: Verify retry logic doesn't leak credentials or sensitive data
- SSH security: Verify host key checking enforced by default
- Concurrent access: Test thread safety with race detector
- Document all exported functions, types, and constants
- Include usage examples in godoc comments
- Update README.md for significant changes
- Document NETCONF capabilities required and security implications
This project aims for full RFC compliance:
- RFC 6241: NETCONF Protocol - All base operations must comply
- RFC 6242: NETCONF over SSH - Transport layer compliance required
When implementing NETCONF operations, reference relevant RFC sections in code comments.
All PRs must meet these requirements:
- At least one approval
- CI passes (tests, lint, coverage, security)
- Code follows style guidelines
- SPDX headers present in all Go files
- Documentation updated
- Security implications considered
- Breaking changes discussed (requires major version bump)
- Open an issue for questions
- Start a discussion in GitHub Discussions
- Reach out to maintainers
By contributing, you agree that your contributions will be licensed under the Mozilla Public License Version 2.0.