BingsanBingsan
Contributing

Development

Setting up the development environment

Development Environment

Set up your local development environment for Bingsan.

Prerequisites

  • Go 1.23+
  • Docker and Docker Compose
  • Make
  • PostgreSQL client (psql) - optional

Quick Setup

# Clone and enter directory
git clone https://github.com/teamPaprika/bingsan.git
cd bingsan

# Install Go dependencies
go mod download

# Install development tools
make install-tools

# Copy configuration
cp config.example.yaml config.yaml

# Start PostgreSQL
make docker-up

# Run with hot reload
make dev

Build Commands

# Build binary
make build

# Run without hot reload
make run

# Clean build artifacts
make clean

Database Management

# Apply all migrations
make migrate-up

# Rollback one migration
make migrate-down

# Create new migration
make migrate-create name=add_feature_table

Hot Reload

The project uses air for hot reload during development:

make dev

Air watches for file changes and automatically rebuilds and restarts the server.

IDE Setup

VS Code

Recommended extensions:

  • Go (golang.go)
  • EditorConfig
  • YAML

Settings:

{
  "go.lintTool": "golangci-lint",
  "go.lintFlags": ["--fast"],
  "editor.formatOnSave": true
}

GoLand

  • Enable Go Modules integration
  • Configure golangci-lint as external tool
  • Set gofumpt as the formatter

Environment Variables

For development, environment variables can override config.yaml:

export ICEBERG_SERVER_PORT=8181
export ICEBERG_DATABASE_HOST=localhost
export ICEBERG_DEBUG=true

Debugging

Delve Debugger

# Install delve
go install github.com/go-delve/delve/cmd/dlv@latest

# Debug
dlv debug ./cmd/iceberg-catalog

VS Code Launch Configuration

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Launch Bingsan",
      "type": "go",
      "request": "launch",
      "mode": "auto",
      "program": "${workspaceFolder}/cmd/iceberg-catalog",
      "args": ["-config", "config.yaml"]
    }
  ]
}

On this page