Thank you for your interest in contributing to go-gnmi! 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
- gNMI 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 gNMI specification compliance 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 all new Go files (see Headers section)
- 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-gnmi.git
cd go-gnmi
# 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 gNMI terminology from the specification
All Go source files must include SPDX license identifier and copyright notice:
// SPDX-License-Identifier: MPL-2.0
// Copyright (c) 2025 Daniel Schmidt
package gnmiThe project uses Google's addlicense tool for license header management.
Install addlicense:
go install github.com/google/addlicense@latest
# Or use: make toolsAdd headers to new files:
make licenseVerify headers:
make check-licenseImportant Notes:
- The check command accepts ANY copyright holder name (for open source contributions)
- Contributors from different organizations can keep their own copyright lines
- Both SPDX-first and Copyright-first formats are accepted
- Write unit tests for all new functionality
- Use table-driven tests with edge cases and error conditions
- Test with mock gNMI targets 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 JSON, oversized payloads, invalid paths
- Error handling: Verify retry logic doesn't leak credentials or sensitive data
- TLS security: Verify certificate verification 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 gNMI capabilities required and security implications
This project aims for full gNMI specification compliance:
- gNMI Specification: All operations (Get, Set, Capabilities) must comply
- gRPC Transport: Transport layer compliance required
When implementing gNMI operations, reference relevant specification 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.