0.1.0 • Published 7 years ago

gopackage-map v0.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
7 years ago

GoPackageMap Tool

A powerful tool to show the package relationship between or inside your Golang project services in a modern visualization way.

Get Started

Prerequisites

Notice: You only have to do this step once, feel free to skip if you already have Node an Go installed and running.

Install Node

Make sure you have NodeJS installed.

Install Go

Make sure you have installed Go and be able to access go command to your local terminal.

Install GoMap

run npm install gomap -g to install the gomap tool globally.

Usage

After install the gomap globally, you should be able to access the gomap command in your terminal.

List all possible commands

Whenever you have problems or forget about a command, please do remember this one command will prints all available commands for you.

gomap

Currently, gomap has two simple functions, gomap list and gomap graph.

gomap graph: Visualize the relationship of go project's packages in a graph.

Come into your go project file path, try to run

gomap graph ./your_go_service_folder

Then gomap graph would do two things,

  • First, scan all of the go files under the folder path which your input and generate the packages relationship data.
  • Automatically open your default browser to generalize a visualization result about the relationship of your go dependencies.

You can also get severals services' package relationship by providing multiply path.

For example,

gomap graph ./service_a ./service_b ./service_c

gomap list: Print the dependency relation in the console

The Same usage with gomap graph, just run the next command and you can get the result directly in your console.

gomap list ./your_go_services_folder

Options

You can also add some options when you run the gomap command:

gomap graph ./your_go_service --no_system_libs --no_vendors_libs

The meaning of these options are as follow:

--no_system_libs: Ignore the system libs in your project files;

--no_vendor_libs: Ignore the vendors libs

--no_system_vendors: Ignore both system libs and vendors libs

Visualiziton Explain

The visualizing graph aims to help you get better understand of your go project dependency relationship through these following aspects:

Relationship Type

There are two kind of relationship for each packages:

  • Depends on: means following packages are imported by current pakcage
  • Depended By: means current packages is imported by these following packages.

Folding and Unfolding Service

All services are in the folding mode until you click the button of left legend to unfold the collection.

Two packages will only show the connection line when they are all in the unfolding mode.

Search Specific Service

The serach package container will help you find the specific package you are looking for. There would be a search hint of the possiable package you want to search with you typing.

Show the Documentation

Ater click each package, you will get a list of the current package Depennds on and Depended By info in the bottom of page.

You can switch to the other package just by clicking the package name.

Zoom in and Zoom out the Specific Area

Zoom in and zoom out help you control the visual pan and get a better vision.

Demo

  • After runninng gomap graph:

Demo

  • After running gomap list : go list demo

What's next?

Join #gomap-early-birds channel to discuss questions and ideas with other users.

Let's try utilizing this tool to make our daily work easier and more enjoyable, Cheers!