Giter Site home page Giter Site logo

bofhcoiner / go-callvis Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ondrajz/go-callvis

0.0 1.0 0.0 6.26 MB

Visualize call graph of your Go program using dot format.

Home Page: https://truefurby.github.io/go-callvis

License: MIT License

Makefile 3.38% Go 96.62%

go-callvis's Introduction

gopher

go-callvis

Github release Build status Slack channel

go-callvis is a development tool to help visualize call graph of your Go program using Graphviz's dot format.


Introduction

Purpose of this tool is to provide a visual overview of your program by using the data from call graph and its relations with packages and types. This is especially useful in larger projects where the complexity of the code rises or when you are just simply trying to understand code structure of somebody else.

Features

  • focus specific package in a program
  • group functions by package and methods by type
  • limit packages to custom path prefixes
  • ignore packages containing path prefixes
  • omit calls from/to std packages

Output preview

main

Check out the source code for the above image.

How it works

It runs pointer analysis to construct the call graph of the program and uses the data to generate output in dot format, which can be rendered with Graphviz tools.

Reference guide

Here you can find descriptions for all possible kinds of calls and groups.

Packages / Types

Represented as subgraphs (clusters) in output.

Packages

  • normal corners
  • label on the top

Types

  • rounded corners
  • label on the bottom
Represents Style
focused blue color
stdlib green color
other yellow color

Functions / Methods

Represented as nodes in output.
Represents Style
exported bold border
unexported normal border
anonymous dotted border

Calls

Represented as edges in output.
Represents Style
internal black color
external brown color
static solid line
dynamic dashed line
regular simple arrow
concurrent arrow with circle
deferred arrow with diamond

Quick start

Requirements

Installation

go get -u github.com/TrueFurby/go-callvis
cd $GOPATH/src/github.com/TrueFurby/go-callvis && make

Usage

go-callvis [OPTIONS] <main pkg> | dot -Tpng -o output.png

Options

-focus string
      Focus package with import path or name. (default: main)
-limit string
      Limit package paths to prefix. (separate multiple by comma)
-group string
      Grouping functions by [pkg, type]. (separate multiple by comma)
-ignore string
      Ignore package paths with prefix. (separate multiple by comma)
-nostd
      Omit calls from/to std packages.
-minlen uint
      Minimum edge length (for wider output). (default: 2)
-nodesep float
      Minimum space between two adjacent nodes in the same rank (for taller output). (default: 0.35)

Examples

Here is an example for the project syncthing.

syncthing example

Check out more examples and used command options.

Community

Join #go-callvis channel at gophers.slack.com.

Not a member yet? Get invitation.

How to help

Did you find any bugs or have some suggestions?

Feel free to open new issue or start discussion in the slack channel.

Do you want to contribute to the development?

Fork the project and do a pull request. Here you can find the state of features.

Known Issues

Each execution takes a lot of time, because currently:
  • the call graph is always generated for the entire program
  • there is yet no caching of call graph data

Roadmap

The interactive tool described below has been published as a separate project called goexplorer! ๐Ÿ’ฅ

Ideal goal of this project is to make web app that would locally store the call graph data and then provide quick access of the call graphs for any package of your dependency tree. At first it would show an interactive map of overall dependencies between packages and then by selecting particular package it would show the call graph and provide various options to alter the output dynamically.

go-callvis's People

Contributors

ondrajz avatar truefurby avatar garrettr avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.