Contributing to GoVisual
May 4, 2025 ยท View on GitHub
Thank you for your interest in contributing to GoVisual! This document provides guidelines and instructions for contributing to the project.
Development Setup
Prerequisites
- Go 1.20 or higher
- Docker and Docker Compose (for running the examples with databases)
- Git
Getting Started
- Fork the repository on GitHub
- Clone your fork locally
git clone https://github.com/yourusername/govisual.git cd govisual - Add the original repository as an upstream remote
git remote add upstream https://github.com/doganarif/govisual.git - Install dependencies
go mod download
Running Tests
Run the tests with:
go test ./...
For tests involving storage backends, you can use the provided Docker Compose files:
# For PostgreSQL tests
cd cmd/examples/multistorage
GOVISUAL_STORAGE_TYPE=postgres \
GOVISUAL_PG_CONN="postgres://postgres:postgres@localhost:5432/govisual?sslmode=disable" \
go test ../../internal/store/...
# For Redis tests
GOVISUAL_STORAGE_TYPE=redis \
GOVISUAL_REDIS_CONN="redis://localhost:6379/0" \
go test ../../internal/store/...
Code Style Guidelines
GoVisual follows standard Go coding conventions:
- Run
go fmtbefore committing to ensure consistent formatting - Follow Effective Go guidelines
- Use
golintandgo vetto check for common issues - Write meaningful comments, especially for exported functions and types
- Keep functions small and focused on a single responsibility
- Use meaningful variable and function names that describe their purpose
Contribution Workflow
-
Create a new branch for your feature or bugfix
git checkout -b feature/your-feature-name -
Make your changes, following the code style guidelines
-
Add tests for your changes
-
Run tests to make sure everything works
go test ./... -
Commit your changes with a clear and descriptive commit message
git commit -m "Add support for new feature X" -
Push to your fork
git push origin feature/your-feature-name -
Create a Pull Request against the main repository
Pull Request Guidelines
- Provide a clear description of the problem you're solving
- Update documentation if necessary
- Add or update tests as appropriate
- Keep PRs focused on a single issue/feature to make them easier to review
- Make sure CI tests pass
Adding Storage Backends
When adding a new storage backend:
- Implement the
Storeinterface ininternal/store/store.go - Add relevant configuration options in
options.go - Update factory methods in
internal/store/factory.go - Add documentation in
docs/storage-backends.md - Create examples showing usage
Reporting Issues
When reporting issues, please include:
- A clear description of the problem
- Steps to reproduce
- Expected vs. actual behavior
- Version of GoVisual you're using
- Go version and OS
- Any relevant logs or error messages
License
By contributing to GoVisual, you agree that your contributions will be licensed under the project's MIT license.