Thank you for your interest in contributing to envdoc! We welcome contributions from the community.
- Code of Conduct
- Getting Started
- Development Setup
- Making Changes
- Code Style
- Testing
- Submitting Changes
- Reporting Bugs
- Requesting Features
This project adheres to a code of conduct. By participating, you are expected to uphold this code. Please be respectful and considerate to others.
- Fork the repository on GitHub
- Clone your fork locally
- Set up the development environment
- Create a new branch for your changes
- Make your changes
- Test your changes
- Submit a pull request
- Go 1.25 or higher
- Git
# Clone your fork
git clone https://github.com/YOUR_USERNAME/envdoc-go.git
cd envdoc-go
# Add the upstream repository
git remote add upstream https://github.com/MayR-Labs/envdoc-go.git
# Install dependencies
go mod download
# Build the project
go build -o envdoc .
# Run the binary
./envdoc --helpAlways create a new branch for your changes:
git checkout -b feature/your-feature-name
# or
git checkout -b fix/your-bug-fixBranch naming conventions:
feature/- for new featuresfix/- for bug fixesdocs/- for documentation changesrefactor/- for code refactoring
Write clear and descriptive commit messages:
git commit -m "feat: add new feature X"
git commit -m "fix: resolve issue with Y"
git commit -m "docs: update README with installation instructions"Commit message format:
feat:- new featurefix:- bug fixdocs:- documentation changesrefactor:- code refactoringtest:- adding or updating testschore:- maintenance tasks
Follow the Effective Go guidelines and these additional rules:
-
Format your code: Run
gofmtbefore committinggofmt -w . -
Use meaningful names: Variables, functions, and types should have descriptive names
-
Keep functions small: Each function should do one thing well
-
Add comments: Add comments for exported functions, types, and packages
// ParseEnvFile parses a .env file and returns a list of environment variables func ParseEnvFile(filename string) ([]EnvVar, error) { // implementation }
-
Handle errors: Always check and handle errors appropriately
if err != nil { return fmt.Errorf("failed to parse file: %w", err) }
-
Use constants: Define constants for magic values
const ( defaultTimeout = 30 * time.Second maxRetries = 3 )
# Run all tests
go test ./...
# Run tests with coverage
go test -cover ./...
# Run tests for a specific package
go test ./internal/parser
# Run tests in verbose mode
go test -v ./...-
Place test files next to the code they test (e.g.,
parser.go→parser_test.go) -
Use table-driven tests when appropriate:
func TestParseEnvFile(t *testing.T) { tests := []struct { name string input string want []EnvVar wantErr bool }{ { name: "valid file", input: "KEY=value", want: []EnvVar{{Key: "KEY", Value: "value"}}, }, // more test cases... } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := ParseEnvFile(tt.input) if (err != nil) != tt.wantErr { t.Errorf("ParseEnvFile() error = %v, wantErr %v", err, tt.wantErr) } // assertions... }) } }
- Format your code:
gofmt -w . - Run tests:
go test ./... - Build the project:
go build -o envdoc . - Update documentation: If you changed functionality, update README.md
- Add changelog entry: Update CHANGELOG.md with your changes
-
Push your branch to your fork:
git push origin feature/your-feature-name
-
Go to the original repository on GitHub
-
Click "New Pull Request"
-
Select your branch
-
Fill out the PR template:
- Title: Clear, concise description of changes
- Description: Detailed explanation of what and why
- Related Issues: Link any related issues
- Testing: Describe how you tested your changes
- Screenshots: Add screenshots if applicable
-
Submit the pull request
- A maintainer will review your PR
- Address any feedback or requested changes
- Once approved, your PR will be merged
- Check if the bug has already been reported in Issues
- Make sure you're using the latest version
- Try to reproduce the bug
When reporting a bug, include:
- Title: Clear, descriptive title
- Description: What happened vs. what you expected
- Steps to Reproduce:
1. Run command X 2. With arguments Y 3. See error Z - Environment:
- OS: (e.g., Ubuntu 22.04, macOS 13, Windows 11)
- Go version: (run
go version) - envdoc version: (run
envdoc version)
- Additional Context: Any other relevant information
- Title: Clear description of the feature
- Problem: What problem does this solve?
- Proposed Solution: How should it work?
- Alternatives: Other solutions you've considered
- Additional Context: Any other relevant information
If you have questions, feel free to:
- Open an issue with the
questionlabel - Reach out to the maintainers
By contributing to envdoc, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing to envdoc! 🎉