Development Setup

Get your development environment ready to contribute to Gonzo. This guide covers everything from prerequisites to running your first build.

Prerequisites

Required Software

Go Programming Language:

  • Version: 1.21 or higher

  • Download: https://golang.org/dl/

  • Installation guide: https://golang.org/doc/install

# Verify Go installation
go version
# Should show: go version go1.21.x or higher

Git:

  • Version: 2.0 or higher

  • Download: https://git-scm.com/downloads

# Verify Git installation
git --version

Make (optional but recommended):

  • Usually pre-installed on macOS/Linux

  • Windows: Install via Chocolatey or use Git Bash

Code Editor:

  • VS Code with Go extension

  • GoLand

  • Vim/Neovim with vim-go

  • Any editor with Go support

Terminal:

  • Modern terminal with good Unicode support

  • Recommendations: iTerm2, Alacritty, Windows Terminal

Additional Tools:

Getting the Source Code

Fork the Repository

  1. Go to https://github.com/control-theory/gonzo

  2. Click "Fork" button (top right)

  3. This creates your own copy of the repository

Clone Your Fork

Sync with Upstream

Keep your fork up to date:

Project Structure

Understanding the codebase:

Building Gonzo

Quick Build

Manual Build

Development Build

Build for All Platforms

Running Tests

Unit Tests

Race Detection

Coverage Report

Integration Tests

Running Gonzo in Development

Basic Run

With Sample Data

Testing Features

Test file input:

Test stdin:

Test follow mode:

Test OTLP receiver:

Development Workflow

1. Create a Feature Branch

2. Make Changes

3. Test Changes

4. Commit Changes

5. Push to Your Fork

6. Create Pull Request

  1. Go to your fork on GitHub

  2. Click "Compare & pull request"

  3. Fill out PR template

  4. Submit pull request

Code Style

Formatting

Linting

Code Conventions

Naming:

  • Use camelCase for variables and functions

  • Use PascalCase for exported names

  • Keep names short but descriptive

  • Avoid abbreviations unless common

Comments:

Error Handling:

Debugging

Using Delve

Logging Debug Info

VS Code Debug Configuration

Create .vscode/launch.json:

Common Development Tasks

Adding a New Feature

  1. Plan the feature

    • Open an issue to discuss

    • Get feedback from maintainers

    • Design the implementation

  2. Implement the feature

    • Create feature branch

    • Write code following style guide

    • Add tests for new functionality

    • Update documentation

  3. Test thoroughly

    • Unit tests

    • Integration tests

    • Manual testing

  4. Submit for review

    • Create pull request

    • Address review comments

    • Wait for approval

Fixing a Bug

  1. Reproduce the bug

    • Create minimal test case

    • Document steps to reproduce

  2. Write a failing test

    • Test should fail before fix

    • Test should pass after fix

  3. Fix the bug

    • Make minimal changes

    • Ensure test passes

  4. Submit fix

    • Reference issue in commit

    • Include test in PR

Updating Dependencies

Performance Profiling

CPU Profiling

Memory Profiling

Benchmarking

Troubleshooting Development Issues

Build Fails

Dependency issues:

Version mismatch:

Tests Fail

Race conditions:

Flaky tests:

  • Run tests multiple times

  • Check for timing dependencies

  • Use proper synchronization

IDE Issues

VS Code Go extension problems:

Gopls issues:

Getting Help

Resources

  • GitHub Issues: Ask questions, report bugs

  • GitHub Discussions: General discussions

  • Code Review: Learn from PR feedback

  • Documentation: Read existing docs thoroughly

Communication

  • Be respectful: Follow Code of Conduct

  • Be patient: Maintainers are volunteers

  • Be clear: Provide context and details

  • Be helpful: Help others when you can

Next Steps

Now that your development environment is set up:

  1. Read the codebase: Familiarize yourself with the structure

  2. Pick an issue: Look for "good first issue" labels

  3. Make a change: Start with something small

  4. Submit a PR: Get feedback and iterate

Related Documentation:

  • Contribution Guidelines - Detailed contribution process

  • Community - How to engage with the community

  • Architecture Overview - Understanding the codebase

circle-check

Last updated