goanalysis

command module
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2025 License: MIT Imports: 1 Imported by: 0

README ΒΆ

πŸ” GoAnalysis

δΈ­ζ–‡η‰ˆ | English

GoAnalysis

Go Function Tracing & Visualization Tool

License Version Go

🌟 Overview

Professional Go function tracing analysis tool with advanced visualization. Built with Kratos backend and Vue3 frontend.

πŸš€ Features

  • πŸ” Function Tracing - Real-time goroutine execution capture
  • πŸ“Š Visualization - Interactive Mermaid flowcharts and heatmaps
  • πŸ“ˆ Performance - Bottleneck identification and analysis
  • πŸ”„ Git Integration - GitLab MR change analysis
  • 🌐 Web UI - Modern Vue3 interface

πŸ› οΈ Tech Stack

  • Backend: Kratos, gRPC, SQLite
  • Frontend: Vue3, Bootstrap, ECharts
  • Visualization: Mermaid.js, D3.js

πŸš€ Quick Start

Using Pre-built Binaries
  1. Download from GitHub Releases
  2. Extract and run:
    # Linux - Start with default configuration
    ./goanalysis-linux-v* server
    
    # Windows - Start with default configuration
    goanalysis-windows-v*.exe server
    
  3. Open http://localhost:8001
Building from Source
git clone https://github.com/toheart/goanalysis.git
cd goanalysis
make init
make sync-frontend  
make build
./bin/goanalysis server

βš™οΈ Configuration

GoAnalysis now supports direct configuration via command line arguments without creating config files:

# Start with default configuration
./goanalysis server

# Customize port and log level
./goanalysis server --http-addr=0.0.0.0:8080 --log-level=info

# Customize database path
./goanalysis server --db-path=./my-database.db

# Set GitLab configuration
./goanalysis server --gitlab-token="your-token" --gitlab-url="https://gitlab.com/api/v4"
πŸ“‹ All Available Parameters
# View all available parameters
./goanalysis server --help

Server Configuration:

  • --http-addr - HTTP server address (default: 0.0.0.0:8001)
  • --grpc-addr - gRPC server address (default: 0.0.0.0:9000)
  • --http-timeout - HTTP timeout (default: 1s)
  • --grpc-timeout - gRPC timeout (default: 1s)

Logging Configuration:

  • --log-level - Log level (default: debug)
  • --log-file - Log file path (default: ./logs/app.log)
  • --log-console - Output to console (default: true)

GitLab Configuration:

  • --gitlab-token - GitLab access token
  • --gitlab-url - GitLab API URL
  • --gitlab-clone-dir - Clone directory (default: ./data)

OpenAI Configuration:

  • --openai-api-key - OpenAI API key
  • --openai-api-base - OpenAI API base URL
  • --openai-model - OpenAI model name

Storage Paths:

  • --static-store-path - Static storage path (default: ./data/static)
  • --runtime-store-path - Runtime storage path (default: ./data/runtime)
  • --file-storage-path - File storage path (default: ./data/files)

Data Configuration:

  • --db-path - Database path (default: ./goanalysis.db)
πŸ” Environment Variables Support

Sensitive information can also be set via environment variables:

export GITLAB_TOKEN="your-gitlab-token"
export GITLAB_API_URL="https://gitlab.com/api/v4"
export OPENAI_API_KEY="your-openai-key"
export OPENAI_API_BASE="https://api.openai.com/v1"
export OPENAI_MODEL="gpt-3.5-turbo"

./goanalysis server
πŸ“„ Traditional: Configuration File

Still supports traditional configuration file approach:

# Generate default configuration file
./goanalysis config

# Start with configuration file
./goanalysis server --conf=configs/config.yaml

Configuration file example:

server:
  http:
    addr: 0.0.0.0:8001
  grpc:
    addr: 0.0.0.0:9000

logger:
  level: debug
  file_path: ./logs/app.log
  console: true

biz:
  gitlab:
    token: "${GITLAB_TOKEN}"
    url: "${GITLAB_API_URL}"
    clone_dir: ./data
  openai:
    api_key: "${OPENAI_API_KEY}"
    api_base: "${OPENAI_API_BASE}"
    model: "${OPENAI_MODEL}"

data:
  dbpath: ./goanalysis.db
πŸ”„ Configuration Priority

Configuration priority from high to low:

  1. Command Line Arguments - Highest priority
  2. Environment Variables - For sensitive information
  3. Configuration File - Traditional approach
  4. Default Values - Lowest priority

πŸ”§ Usage

Basic Tracing
# Start with default configuration
./goanalysis server

# Start with custom configuration
./goanalysis server --http-addr=0.0.0.0:8080 --log-level=info

# Code rewriting
./goanalysis rewrite -d /path/to/project
Git Analysis
# Set GitLab configuration
export GITLAB_TOKEN="your-token"
export GITLAB_API_URL="https://gitlab.com/api/v4"

# Start server
./goanalysis server

πŸ“‚ Project Structure

β”œβ”€β”€ api/           # API definitions
β”œβ”€β”€ cmd/           # CLI commands  
β”œβ”€β”€ internal/      # Core logic
β”œβ”€β”€ web/           # Frontend files
└── configs/       # Configuration

πŸ—οΈ Deployment

Docker
docker run -p 8000:8000 -p 9000:9000 \
  ghcr.io/toheart/goanalysis:latest
Build
make package-linux
make package-windows

πŸ”§ Troubleshooting

Issue Solution
Port in use lsof -i :8000; kill -9 <PID>
DB locked rm -f goanalysis.db-*
Frontend missing make sync-frontend

🀝 Contributing

  1. Fork repository
  2. Create feature branch
  3. Make changes with tests
  4. Submit pull request

Follow Conventional Commits.

πŸ“œ Releases

Version Date Changes
v1.1.4 2024-12-16 GitLab integration
v1.1.0 2024-12-01 Vue3 upgrade
v1.0.0 2024-11-15 First stable

πŸ“„ License

MIT License - see LICENSE file.

πŸ“ž Support

  • πŸ› Issues: GitHub Issues
  • πŸ’¬ Discussions: GitHub Discussions
  • πŸ“– Docs: Wiki
  • πŸ“± WeChat: Follow "ε°ε”ηš„ζŠ€ζœ―ζ—₯εΏ—" for updates

πŸ“± Follow WeChat

ε°ε”ηš„ζŠ€ζœ―ζ—₯εΏ—

WeChat QR Code

Scan for latest updates


GoAnalysis - Empowering Go developers

⭐ Star us on GitHub!

Documentation ΒΆ

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL