Skip to content
/ goscope Public

πŸ”¬Go Codebase analyzer / Statistics report for your codebase / Developer Onboarding on Go Project

License

Notifications You must be signed in to change notification settings

Exey/goscope

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”¬ goscope

CLI tool for Go backend codebase intelligence β€” analyze microservices, generate dependency graphs, detect tech stack, and produce an interactive HTML report.

Built in pure Go with zero external dependencies.


⚑ Generate Report in 10 Seconds

cd goscope
go run ./cmd/goscope ~/backend --open

Where ~/backend is the parent folder where all your backend service repositories are cloned:

~/backend/
β”œβ”€β”€ api-gateway/      ← cloned repo (.git inside)
β”œβ”€β”€ user-service/     ← cloned repo
β”œβ”€β”€ payment-service/  ← cloned repo
β”œβ”€β”€ proto/            ← shared proto definitions
β”œβ”€β”€ auth-service/     ← cloned repo
└── docker-compose.yml

Services are auto-detected up to 3 levels deep, so layouts like src/<service>/ or services/<service>/ also work. Non-Go services (Python, Java, PHP, etc.) are detected and shown in the report with language badges.

Result


What the Report Contains

  1. πŸ“Š Summary β€” microservice count, Go files, lines of code, declarations by type (structs, interfaces, enums, functions), proto files, gRPC services. Non-Go services detected in the repo tree get line count cards per language (Python, Java, etc.)

  2. πŸ‘₯ Team Contribution Map β€” developer activity with files modified, commit counts, first/last change dates, and top-3 microservices per author. Git history is collected from each cloned repo's .git independently

  3. πŸ“š Tech Stack β€” three subsections:

    • Technologies β€” auto-detected from Go imports (pgx β†’ PostgreSQL, sarama β†’ Kafka, etc.), go.mod dependencies, docker-compose.yml images/ports, and Makefile hints. Non-Go languages shown with orange badges
    • Microservices β€” clickable grid of all detected microservices, including non-Go services with language badges
    • Architecture β€” interactive force-directed graph showing how microservices connect to technologies
  4. πŸ”— Microservices Penetration β€” which microservice is imported by the most other microservices, plus TODO/FIXME density per microservice

  5. πŸ”₯ Hot Zones β€” top 10 most interconnected files by PageRank dependency score, with clickable microservice badges

  6. πŸ“ Longest Functions β€” ranked list of functions by line count, with clickable microservice badges

  7. πŸ”§ Microservices β€” detailed breakdown of each microservice (starting with API Gateway, then Proto, then by size):

    • Complete file inventory sorted by lines of code
    • Declaration statistics (structs, interfaces, enums, funcs, gRPC services/RPCs)
    • Interactive force-directed dependency graph per microservice (includes big functions β‰₯50 lines)

πŸš€ Quick Start

cd goscope

# Build
go build -o goscope ./cmd/goscope

# Analyze a Go backend (point to the parent folder with all repos)
./goscope ~/backend

# See help
./goscope --help

πŸ—οΈ Build & Install

Option 1: Go Run (Recommended for first try)

go run ./cmd/goscope ~/backend --open

Option 2: Build Binary

go build -o goscope ./cmd/goscope
./goscope ~/backend --open

Option 3: Install System-Wide

go build -o goscope ./cmd/goscope
sudo mv goscope /usr/local/bin/
goscope ~/backend --open

βš™οΈ Configuration

Create .goscope.json in your project root (or run goscope init):

{
  "excludePaths": [".git", "node_modules", "vendor", "dist", "build", ".idea"],
  "maxFilesAnalyze": 50000,
  "gitCommitLimit": 1000,
  "enableCache": false,
  "enableParallel": true,
  "hotspotCount": 15,
  "fileExtensions": ["go", "proto"]
}

πŸ“ Project Structure

goscope/
β”œβ”€β”€ go.mod
β”œβ”€β”€ cmd/goscope/
β”‚   └── main.go              # CLI entry point
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ config/
β”‚   β”‚   └── config.go        # Config models + loader
β”‚   β”œβ”€β”€ scanner/
β”‚   β”‚   └── scanner.go       # Directory walker, microservice detection, tech scanning
β”‚   β”œβ”€β”€ parser/
β”‚   β”‚   β”œβ”€β”€ models.go        # ParsedFile, Declaration, GitMetadata
β”‚   β”‚   └── parser.go        # Go + Proto parsers
β”‚   β”œβ”€β”€ git/
β”‚   β”‚   └── analyzer.go      # Multi-repo batch git log analysis
β”‚   β”œβ”€β”€ graph/
β”‚   β”‚   β”œβ”€β”€ graph.go         # Dependency graph + PageRank
β”‚   β”‚   └── util.go          # File helpers
β”‚   └── report/
β”‚       └── report.go        # HTML report generator
└── README.md

Requirements

  • Go 1.22+ (uses standard library only β€” no external dependencies)
  • git (for repository history analysis)

About

πŸ”¬Go Codebase analyzer / Statistics report for your codebase / Developer Onboarding on Go Project

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages