Giter Club home page Giter Club logo

goviz's Introduction

goviz

a visualization tool for golang project dependency

This tool is for helping source code reading. The dependency of the whole code can be visualized quickly.

Installation

go get github.com/hirokidaichi/goviz

and if not being installed graphviz, install it :

brew install graphviz

Usage

goviz -i github.com/hashicorp/serf | dot -Tpng -o hoge.png

Option

Usage:
  goviz [OPTIONS]

Application Options:
  -i, --input=   intput ploject name
  -o, --output=  output file (STDOUT)
  -d, --depth=   max plot depth of the dependency tree (128)
  -f, --focus=   focus on the specific module
  -s, --search=  top directory of searching
  -l, --leaf     whether leaf nodes are plotted (false)
  -m, --metrics  display module metrics (false)

Help Options:
  -h, --help     Show this help message

exit status 1

Samples

goviz -i github.com/mattn/anko | dot -Tpng -o anko.png

goviz -i github.com/hashicorp/serf | dot -Tpng -o serf.png

goviz -i github.com/lestrrat/go-xslate | dot -Tpng -o xslate.png

goviz -i github.com/tsenart/vegeta -l| dot -Tpng -o vegeta.png

goviz -i github.com/mitchellh/packer --search SELF| dot -Tpng -o packer.png

goviz -i github.com/dotcloud/docker/docker -s github.com/dotcloud/docker -d 1| dot -Tpng -o docker1.png

goviz -i github.com/dotcloud/docker/docker -s github.com/dotcloud/docker -d 2| dot -Tpng -o docker2.png

goviz -i github.com/dotcloud/docker/docker -s github.com/dotcloud/docker -d 3| dot -Tpng -o docker3.png

goviz -i github.com/dotcloud/docker/runtime/execdriver/execdrivers/ -s github.com/dotcloud/docker| dot -Tpng -o docker-execdrivers.png

docker's metrics

goviz has a function which outputs the metrics (instability) of go project.

goviz -i github.com/dotcloud/docker/docker -m 

Instability is a value of 0 to 1. It suggests that it is such an unstable module that this value is high. It becomes easy to distinguish whether it is a module nearer to application layer, and whether it is a module near a common library.

Inst:1.000 Ca(  0) Ce(  9)	github.com/dotcloud/docker/docker
Inst:0.960 Ca(  1) Ce( 24)	github.com/dotcloud/docker/pkg/libcontainer/nsinit
Inst:0.956 Ca(  2) Ce( 43)	github.com/dotcloud/docker/runtime
Inst:0.950 Ca(  1) Ce( 19)	github.com/dotcloud/docker/api/client
Inst:0.950 Ca(  1) Ce( 19)	github.com/dotcloud/docker/server
Inst:0.909 Ca(  1) Ce( 10)	github.com/dotcloud/docker/api/server
Inst:0.867 Ca(  2) Ce( 13)	github.com/dotcloud/docker/runtime/execdriver/native
Inst:0.857 Ca(  1) Ce(  6)	github.com/dotcloud/docker/runtime/graphdriver/devmapper
Inst:0.833 Ca(  1) Ce(  5)	github.com/dotcloud/docker/runtime/graphdriver/aufs
Inst:0.800 Ca(  1) Ce(  4)	github.com/dotcloud/docker/builtins
Inst:0.800 Ca(  2) Ce(  8)	github.com/dotcloud/docker/runtime/networkdriver/bridge
Inst:0.800 Ca(  1) Ce(  4)	github.com/dotcloud/docker/runtime/execdriver/execdrivers
Inst:0.778 Ca(  2) Ce(  7)	github.com/dotcloud/docker/pkg/libcontainer/network
Inst:0.750 Ca(  1) Ce(  3)	github.com/dotcloud/docker/sysinit
Inst:0.750 Ca(  3) Ce(  9)	github.com/dotcloud/docker/runtime/execdriver/lxc
Inst:0.750 Ca(  1) Ce(  3)	github.com/dotcloud/docker/runtime/execdriver/native/template
Inst:0.727 Ca(  3) Ce(  8)	github.com/dotcloud/docker/graph
Inst:0.667 Ca(  1) Ce(  2)	github.com/dotcloud/docker/runtime/execdriver/native/configuration
Inst:0.667 Ca(  1) Ce(  2)	github.com/dotcloud/docker/runtime/networkdriver/portmapper
Inst:0.667 Ca(  1) Ce(  2)	github.com/dotcloud/docker/runtime/networkdriver/ipallocator
Inst:0.667 Ca(  1) Ce(  2)	github.com/dotcloud/docker/links
Inst:0.571 Ca(  9) Ce( 12)	github.com/dotcloud/docker/runconfig
Inst:0.500 Ca(  2) Ce(  2)	github.com/dotcloud/docker/pkg/selinux
Inst:0.500 Ca(  5) Ce(  5)	github.com/dotcloud/docker/api
Inst:0.500 Ca(  2) Ce(  2)	github.com/dotcloud/docker/daemonconfig
Inst:0.500 Ca(  5) Ce(  5)	github.com/dotcloud/docker/image
Inst:0.500 Ca(  1) Ce(  1)	github.com/dotcloud/docker/pkg/libcontainer/capabilities
Inst:0.500 Ca(  1) Ce(  1)	github.com/gorilla/mux
Inst:0.500 Ca(  1) Ce(  1)	github.com/dotcloud/docker/runtime/graphdriver/btrfs
Inst:0.500 Ca(  1) Ce(  1)	github.com/dotcloud/docker/runtime/graphdriver/vfs
Inst:0.444 Ca( 10) Ce(  8)	github.com/dotcloud/docker/archive
Inst:0.333 Ca(  2) Ce(  1)	github.com/dotcloud/docker/opts
Inst:0.333 Ca(  2) Ce(  1)	github.com/dotcloud/docker/runtime/networkdriver/portallocator
Inst:0.250 Ca(  6) Ce(  2)	github.com/dotcloud/docker/registry
Inst:0.250 Ca(  6) Ce(  2)	github.com/dotcloud/docker/pkg/cgroups
Inst:0.250 Ca(  3) Ce(  1)	github.com/dotcloud/docker/pkg/sysinfo
Inst:0.250 Ca(  3) Ce(  1)	github.com/dotcloud/docker/runtime/networkdriver
Inst:0.154 Ca( 11) Ce(  2)	github.com/dotcloud/docker/runtime/graphdriver
Inst:0.125 Ca(  7) Ce(  1)	github.com/dotcloud/docker/pkg/label
Inst:0.091 Ca( 10) Ce(  1)	github.com/dotcloud/docker/nat
Inst:0.083 Ca( 11) Ce(  1)	github.com/dotcloud/docker/runtime/execdriver
Inst:0.077 Ca( 36) Ce(  3)	github.com/dotcloud/docker/utils
Inst:0.067 Ca( 14) Ce(  1)	github.com/dotcloud/docker/engine
Inst:0.056 Ca( 17) Ce(  1)	github.com/dotcloud/docker/pkg/libcontainer
Inst:0.000 Ca(  2) Ce(  0)	github.com/dotcloud/docker/pkg/collections
Inst:0.000 Ca(  1) Ce(  0)	github.com/gorilla/context
Inst:0.000 Ca(  1) Ce(  0)	code.google.com/p/go.net/websocket
Inst:0.000 Ca(  7) Ce(  0)	github.com/dotcloud/docker/dockerversion
Inst:0.000 Ca(  3) Ce(  0)	github.com/dotcloud/docker/pkg/mflag
Inst:0.000 Ca(  4) Ce(  0)	github.com/dotcloud/docker/pkg/mount
Inst:0.000 Ca(  1) Ce(  0)	github.com/dotcloud/docker/pkg/namesgenerator
Inst:0.000 Ca(  4) Ce(  0)	github.com/dotcloud/docker/pkg/netlink
Inst:0.000 Ca(  1) Ce(  0)	github.com/dotcloud/docker/pkg/proxy
Inst:0.000 Ca(  1) Ce(  0)	github.com/dotcloud/docker/pkg/listenbuffer
Inst:0.000 Ca(  2) Ce(  0)	github.com/dotcloud/docker/pkg/signal
Inst:0.000 Ca( 10) Ce(  0)	github.com/dotcloud/docker/pkg/system
Inst:0.000 Ca(  2) Ce(  0)	github.com/dotcloud/docker/pkg/systemd
Inst:0.000 Ca(  6) Ce(  0)	github.com/dotcloud/docker/pkg/term
Inst:0.000 Ca(  3) Ce(  0)	github.com/dotcloud/docker/pkg/user
Inst:0.000 Ca(  2) Ce(  0)	github.com/dotcloud/docker/pkg/version
Inst:0.000 Ca(  2) Ce(  0)	github.com/dotcloud/docker/pkg/libcontainer/utils
Inst:0.000 Ca(  4) Ce(  0)	github.com/dotcloud/docker/pkg/libcontainer/apparmor
Inst:0.000 Ca(  2) Ce(  0)	github.com/dotcloud/docker/pkg/iptables
Inst:0.000 Ca(  2) Ce(  0)	github.com/dotcloud/docker/pkg/graphdb
Inst:0.000 Ca(  5) Ce(  0)	github.com/dotcloud/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar

License

MIT

Author

hirokidaichi [at] gmail.com

goviz's People

Contributors

hirokidaichi avatar lestrrat avatar syohex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

goviz's Issues

Option to hide filenames

Hi,

The filename display is nice but it behaves badly when packages contain a large number of files (e.g. golang.org/x/sys/unix).

Please consider adding an option to hide filename display,

Thanks

No output on ubuntu

go get github.com/hirokidaichi/goviz Worked fine
sudo apt install graphviz Worked fine
goviz -i github.com/mattn/anko | dot -Tpng -o anko.png Had no output, image was not create
goviz -h No output
goviz executable is present in bin folder but executing it does not output anything.

[Error] runtime error: invalid memory address or nil pointer dereference

This is what I get. I can come back with config files if you want, but in a nutshell I'm running a pretty vanilla Mavericks with the latest go, brew, zsh, etc

➜  ~  goviz -i github.com/hashicorp/serf | dot -Tpng -o hoge.png
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x18 pc=0x20ee]

goroutine 1 [running]:
runtime.panic(0x12c680, 0x2ce219)
    /usr/local/Cellar/go/1.2.1/libexec/src/pkg/runtime/panic.c:266 +0xb6
main.main()
    /Users/andrei/src/github.com/hirokidaichi/goviz/goviz.go:40 +0x7e
➜  ~  goviz -i github.com/mattn/anko | dot -Tpng -o anko.png
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x18 pc=0x20ee]

goroutine 1 [running]:
runtime.panic(0x12c680, 0x2ce219)
    /usr/local/Cellar/go/1.2.1/libexec/src/pkg/runtime/panic.c:266 +0xb6
main.main()
    /Users/andrei/src/github.com/hirokidaichi/goviz/goviz.go:40 +0x7e
➜  ~  goviz -i github.com/dotcloud/docker/docker -m
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x18 pc=0x20ee]

goroutine 1 [running]:
runtime.panic(0x12c680, 0x2ce219)
    /usr/local/Cellar/go/1.2.1/libexec/src/pkg/runtime/panic.c:266 +0xb6
main.main()
    /Users/andrei/src/github.com/hirokidaichi/goviz/goviz.go:40 +0x7e

Suggestion: an option to exclude `std` (standard library)?

It's super nice being able to use --search to limit to the packages that are part of an application without showing dependencies of all the third-party libraries.

It's also nice to combine --search with --leaf to show those third-party libraries without all the details.

But then all the standard library packages like fmt end up in the graph too. Maybe they could be excluded somehow?

For an example of what I'm thinking, something like this where the go-flags package is shown as is, but the other leaf packages (std) are not.

viz

goviz -i github.com/hirokidaichi/goviz -s github.com/hirokidaichi/goviz -l | dot -Tpng -o viz.png

I would probably suggest hiding std packages by default and having a --std option to include them.

Unable to handle GOPATH with multiple paths.

export GOPATH=/tmp/go_a:/tmp/go_b
go get github.com/hirokidaichi/goviz
goviz -i github.com/hirokidaichi/goviz
// Output:
// inputdir does not exist.
// go get github.com/hirokidaichi/goviz

No Output At All

Running goviz generates no output at all, I don't even get the help message with -h. No commands provide any output at all. It was installed with go get github.com/hirokidaichi/goviz. Using go version 1.6.3 on Ubuntu 16.04.1.

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.