CodeMapper is a tool designed to analyze large Go codebases and visualize function dependencies in an interactive graph.
It helps you understand how functions and methods are connected across your project, making onboarding and refactoring much easier! 🚀
UI Inspiration:
The interactive graph UI is inspired by the intuitive workflow editor of n8n.io, making it easy to explore and understand complex code relationships visually.
Analyzing over 40+ repositories for a recent project was extremely time-consuming and challenging, especially given the tight deadlines and complex interdependencies between packages. Manual tracing of function calls and dependencies quickly became unmanageable. To address this, I built CodeMapper to automate the analysis and visualization process, making it much faster and easier to understand large Go codebases.
- Automatic Go code analysis 🧑💻
- Dependency mapping between functions and methods 🔗
- Interactive visualization in your browser 🌐
- Easy to use: just point to your repo and run!
-
Scan your Go project:
CodeMapper parses your codebase, finds all function/method definitions and their call sites. -
Generates a dependency map:
Outputs a JSON file mapping all relationships. -
Visualizes the map:
Launches a web server with a beautiful, interactive graph UI.
-
Install Go (if not already):
Download Go -
Clone the repository and install dependencies:
git clone https://github.com/chinmay-sawant/CodeMapper.git cd CodeMapper go mod tidy
-
Install Node.js (if not already):
Download Node.js -
Install frontend dependencies:
cd CodeMapper npm install
# 1. Build and run CodeMapper on your Go project
go run main.go -path "./ollama" -gopath "C:\Users\acer\go\pkg\mod" -analyze-deps "bitbucket.org/ggwp1,bitbucket.org/ggwp2" -out "full-codemap.json" -serve ":8080"
# 2. Open your browser and visit
http://localhost:8080This application accepts the following command line arguments:
-path: Specifies the path to the project directory to analyze (e.g.,./revel).-gopath: Sets the Go module cache directory (e.g.,C:\Users\acer\go\pkg\mod).-analyze-deps: Comma-separated list of dependencies to analyze (e.g.,bitbucket.org/ggwp1,bitbucket.org/ggwp2).-out: Output file name for the generated code map (e.g.,full-codemap.json).-serve: Starts a web server on the specified address to serve the results (e.g.,:8080).
main.go- Analyzer and web servervisualizer/- React-based frontend for visualizationcodemap.json- Generated dependency map
MIT




