A golang project code viewer developed by python, it has project tree view and project method calling/called tree view, and you can open the source code from the two views, so, it can help you to understand a golang project quickly.
- need to install golang callgraph, guru
- need to install python-setuptools, python-tornado, python-whoosh, python-jieba, python-chardet, python-toro
# install callgraph & guru sudo apt-get install golang-golang-x-tools # install packages use pip cd ./CallingViewer/requires sudo pip install -r requirements.txt # or install packages use apt-get at Ubuntu sudo apt-get install python-setuptools python-tornado python-whoosh python-chardet python-toro sudo easy_install toro
-
config configuration.yml file, specify host, port or log_level
app_debug: true # LOG_LEVEL # a value of (NOSET, DEBUG, INFO, WARNING, ERROR, CRITICAL) # default NOSET log_level: DEBUG server_host: 127.0.0.1 server_port: 9009 db_type: bsddb # DATA_PATH # a path for all data # data_path: /home/breeze/Develop/CallingViewer/DATA
-
python CallingViewer.py # start CallingViewer service
-
open browser with http://localhost:9009
ex. the main window like below
-
add a golang project, click the Add button at bottom-left, fill the form then click Add
-
Project Name: is the name will display at the top-left select box
-
Project Path: is the root directory path will be the root of the left tree view
-
Go Path: is the environment variable $GOPATH for the Project, eg: /home/user/work/project:/home/user/work/lib
-
Main Path: is the golang Project's main source file path, which file is what you want to analyze, eg: /home/user/work/project/main.go
ex. github.com/flike/idgo fill the form like below
-
after add a golang project, you can see the project's tree view left, right click the node, you can get context menu, left click the menu you can open a new tab with the source code
ex. project's tree view like below
ex. open source code from project's tree view like below
-
type method's name into search input, click Search button, you can get the calling view, if you want the called view, you can select the "Called" option, then click Search button, right click the node, you can get context menu, left click the menu you can open a new tab with the source code where the function be calling/called
ex. calling view like below
ex. open source code from calling view like below
-
you can type keyword in the "Filter" input, so, it will just display the result contained the keyword
-
in the code editor, you can select a key word and right click, then get a context menu, you can use the context menu to 'Go To Definition' or 'Find Referrers', click the context menu ro click the referrers list item, you can open the specified source code file in a new browser tab
ex. get editor context menu like below
ex. get referrers list like below