Guide
Contributing to Fabric
How to set up a development environment, run tests, and submit pull requests to the Fabric project.
Overview
Thank you for your interest in contributing to Fabric! We welcome contributions from the community to help improve this CLI tool for geospatial data processing.
Prerequisites
Before you begin, ensure you have the following installed:
| Requirement | Version | Purpose |
|---|---|---|
| Go | 1.21+ | Build the CLI |
| Docker | Latest | Run containerized tasks |
| Make | Any | Build and test commands |
Setting Up Your Environment
1. Fork the Repository
Fork github.com/m42space/fabric on GitHub.
2. Clone Your Fork
git clone https://github.com/YOUR_USERNAME/fabric.git
cd fabric
3. Create a Branch
Create a branch for your feature or bug fix:
git checkout -b feature/my-new-feature
Use descriptive branch names:
feature/add-export-commandfix/workspace-deletion-bugdocs/improve-readme
Development Workflow
Building the CLI
Build for your current platform:
make build
The binary is created at bin/<version>/fabric.
Build for all supported platforms (Linux, macOS, Windows; amd64, arm64):
make cross-build
Running Tests
All tests must pass before merging. Run the full test suite:
make test
Or use Go directly:
go test ./...
Formatting Code
Ensure your code follows Go standards:
make format
Project Structure
fabric/
├── cmd/
│ └── fabric/ # Main CLI entry point
├── pkg/
│ └── fabric/ # Core logic
│ ├── workspace/ # Workspace management
│ ├── pipeline/ # Pipeline execution
│ └── task/ # Task handling
├── bin/ # Build output
└── Makefile # Build commands
| Directory | Purpose |
|---|---|
cmd/ |
Main applications and CLI entry points |
pkg/ |
Library code usable by external applications |
bin/ |
Compiled binaries (gitignored) |
Pull Request Process
1. Write Tests
Add tests for any new functionality. Tests live alongside the code they test:
pkg/fabric/workspace/
├── workspace.go
└── workspace_test.go
2. Update Documentation
Update README.md and any relevant docs if your changes affect user-facing behavior.
3. Verify Tests Pass
make test
4. Submit Your PR
Push your branch and create a Pull Request to main:
git push origin feature/my-new-feature
In your PR description:
- Clearly describe what your changes do
- Explain the problem they solve
- Reference any related issues
5. Respond to Review
Maintainers may request changes. Address feedback promptly and push updates to your branch.
Code Guidelines
Go Conventions
- Follow Effective Go
- Use
gofmtfor formatting - Write clear, descriptive variable names
- Add comments for exported functions
Error Handling
Return errors rather than panicking:
// Good
func LoadWorkspace(name string) (*Workspace, error) {
if name == "" {
return nil, fmt.Errorf("workspace name cannot be empty")
}
// ...
}
// Avoid
func LoadWorkspace(name string) *Workspace {
if name == "" {
panic("workspace name cannot be empty")
}
// ...
}
Logging
Use structured logging with slog:
slog.Info("workspace created", "name", workspace.Name)
slog.Error("failed to pull image", "error", err)
Getting Help
- Discord Community — Ask questions and discuss contributions
- GitHub Issues — Report bugs or request features
- Pull Request Comments — Get feedback from maintainers
License
Contributions are licensed under MIT. By submitting a PR, you agree to license your contribution under the same terms.
We look forward to your contributions!