All Projects โ†’ KyleBanks โ†’ Depth

KyleBanks / Depth

Licence: mit
Visualize Go Dependency Trees

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Depth

Android Audio Visualizer
๐ŸŽผ ๐ŸŽน ๐ŸŽต Audio visualisation for android MediaPlayer ๐Ÿ”‰
Stars: โœญ 468 (-20.68%)
Mutual labels:  visualizer
Transity
Keep track of your ๐Ÿ’ต, ๐Ÿ•˜, ๐Ÿ–, ๐Ÿ„, ๐Ÿป on your command line
Stars: โœญ 528 (-10.51%)
Mutual labels:  command-line-tool
Monstercat Visualizer
A real time audio visualizer for Rainmeter similar to the ones used in the Monstercat videos.
Stars: โœญ 571 (-3.22%)
Mutual labels:  visualizer
K2tf
Kubernetes YAML to Terraform HCL converter
Stars: โœญ 477 (-19.15%)
Mutual labels:  command-line-tool
Legit
Add licenses to projects at the command line
Stars: โœญ 515 (-12.71%)
Mutual labels:  command-line-tool
Rubrowser
a ruby code dependency graph interactive visualizer
Stars: โœญ 532 (-9.83%)
Mutual labels:  visualizer
Keyboardvisualizer
Audio visualizer and effects engine for RGB keyboards, mice, and accessories using the OpenRGB SDK. Supports Windows, Linux, and MacOS. Issue tracker on GitLab (https://gitlab.com/CalcProgrammer1/KeyboardVisualizer)
Stars: โœญ 458 (-22.37%)
Mutual labels:  visualizer
Audio Visualizer Android
๐ŸŽต [Android Library] A light-weight and easy-to-use Audio Visualizer for Android.
Stars: โœญ 581 (-1.53%)
Mutual labels:  visualizer
Npq
๐ŸŽ–safely* install packages with npm or yarn by auditing them as part of your install process
Stars: โœญ 513 (-13.05%)
Mutual labels:  command-line-tool
Zsh Z
Jump quickly to directories that you have visited "frecently." A native ZSH port of z.sh.
Stars: โœญ 562 (-4.75%)
Mutual labels:  command-line-tool
Dotnet Serve
Simple command-line HTTPS server for the .NET Core CLI
Stars: โœญ 481 (-18.47%)
Mutual labels:  command-line-tool
Cbt
CBT - fun, fast, intuitive, compositional, statically checked builds written in Scala
Stars: โœญ 489 (-17.12%)
Mutual labels:  command-line-tool
Cli
A command-line interface for Hetzner Cloud
Stars: โœญ 542 (-8.14%)
Mutual labels:  command-line-tool
Xcov
Nice code coverage reporting without hassle
Stars: โœญ 467 (-20.85%)
Mutual labels:  command-line-tool
Broot
A new way to see and navigate directory trees : https://dystroy.org/broot
Stars: โœญ 6,362 (+978.31%)
Mutual labels:  command-line-tool
Node.cli Progress
โŒ›๏ธ easy to use progress-bar for command-line/terminal applications
Stars: โœญ 466 (-21.02%)
Mutual labels:  command-line-tool
Ttyplot
a realtime plotting utility for terminal/console with data input from stdin
Stars: โœญ 532 (-9.83%)
Mutual labels:  command-line-tool
Jsonui
jsonui is an interactive JSON explorer on your command line
Stars: โœญ 583 (-1.19%)
Mutual labels:  command-line-tool
Summon
CLI that provides on-demand secrets access for common DevOps tools
Stars: โœญ 578 (-2.03%)
Mutual labels:  command-line-tool
The silver searcher
A code-searching tool similar to ack, but faster.
Stars: โœญ 23,030 (+3803.39%)
Mutual labels:  command-line-tool

depth

GoDoc  Build Status  Go Report Card  Coverage Status

depth is tool to retrieve and visualize Go source code dependency trees.

Install

Download the appropriate binary for your platform from the Releases page, or:

go get github.com/KyleBanks/depth/cmd/depth

Usage

depth can be used as a standalone command-line application, or as a package within your own project.

Command-Line

Simply execute depth with one or more package names to visualize. You can use the fully qualified import path of the package, like so:

$ depth github.com/KyleBanks/depth/cmd/depth
github.com/KyleBanks/depth/cmd/depth
  โ”œ encoding/json
  โ”œ flag
  โ”œ fmt
  โ”œ io
  โ”œ log
  โ”œ os
  โ”œ strings
  โ”” github.com/KyleBanks/depth
    โ”œ fmt
    โ”œ go/build
    โ”œ path
    โ”œ sort
    โ”” strings
12 dependencies (11 internal, 1 external, 0 testing).

Or you can use a relative path, for example:

$ depth .
$ depth ./cmd/depth
$ depth ../

You can also use depth on the Go standard library:

$ depth strings
strings
  โ”œ errors
  โ”œ io
  โ”œ unicode
  โ”” unicode/utf8
5 dependencies (5 internal, 0 external, 0 testing).

Visualizing multiple packages at a time is supported by simply naming the packages you'd like to visualize:

$ depth strings github.com/KyleBanks/depth 
strings
  โ”œ errors
  โ”œ io
  โ”œ unicode
  โ”” unicode/utf8
5 dependencies (5 internal, 0 external, 0 testing).
github.com/KyleBanks/depth
  โ”œ fmt
  โ”œ go/build
  โ”œ path
  โ”œ sort
  โ”” strings
7 dependencies (7 internal, 0 external, 0 testing).

-internal

By default, depth only resolves the top level of dependencies for standard library packages, however you can use the -internal flag to visualize all internal dependencies:

$ depth -internal strings
strings
  โ”œ errors
  โ”œ io
    โ”œ errors
    โ”” sync
      โ”œ internal/race
        โ”” unsafe
      โ”œ runtime
        โ”œ runtime/internal/atomic
          โ”” unsafe
        โ”œ runtime/internal/sys
        โ”” unsafe
      โ”œ sync/atomic
        โ”” unsafe
      โ”” unsafe
  โ”œ unicode
  โ”” unicode/utf8
12 dependencies (12 internal, 0 external, 0 testing).

-max

The -max flag limits the dependency tree to the maximum depth provided. For example, if you supply -max 1 on the depth package, your output would look like so:

$ depth -max 1 github.com/KyleBanks/depth/cmd/depth
github.com/KyleBanks/depth/cmd/depth
  โ”œ encoding/json
  โ”œ flag
  โ”œ fmt
  โ”œ io
  โ”œ log
  โ”œ os
  โ”œ strings
  โ”” github.com/KyleBanks/depth
7 dependencies (6 internal, 1 external, 0 testing).

The -max flag is particularly useful in conjunction with the -internal flag which can lead to very deep dependency trees.

-test

By default, depth ignores dependencies that are only required for testing. However, you can view test dependencies using the -test flag:

$ depth -test strings
strings
  โ”œ bytes
  โ”œ errors
  โ”œ fmt
  โ”œ io
  โ”œ io/ioutil
  โ”œ math/rand
  โ”œ reflect
  โ”œ sync
  โ”œ testing
  โ”œ unicode
  โ”œ unicode/utf8
  โ”” unsafe
13 dependencies (13 internal, 0 external, 8 testing).

-explain target-package

The -explain flag instructs depth to print import chains in which the target-package is found:

$ depth -explain strings github.com/KyleBanks/depth/cmd/depth
github.com/KyleBanks/depth/cmd/depth -> strings
github.com/KyleBanks/depth/cmd/depth -> github.com/KyleBanks/depth -> strings

-json

The -json flag instructs depth to output dependencies in JSON format:

$ depth -json github.com/KyleBanks/depth/cmd/depth
{
  "name": "github.com/KyleBanks/depth/cmd/depth",
  "deps": [
    {
      "name": "encoding/json",
      "internal": true,
      "deps": null
    },
    ...
    {
      "name": "github.com/KyleBanks/depth",
      "internal": false,
      "deps": [
        {
          "name": "go/build",
          "internal": true,
          "deps": null
        },
        ...
      ]
    }
  ]
}

Integrating With Your Project

The depth package can easily be used to retrieve the dependency tree for a particular package in your own project. For example, here's how you would retrieve the dependency tree for the strings package:

import "github.com/KyleBanks/depth"

var t depth.Tree
err := t.Resolve("strings")
if err != nil {
    log.Fatal(err)
}

// Output: "'strings' has 4 dependencies."
log.Printf("'%v' has %v dependencies.", t.Root.Name, len(t.Root.Deps)) 

For additional customization, simply set the appropriate flags on the Tree before resolving:

import "github.com/KyleBanks/depth"

t := depth.Tree {
  ResolveInternal: true,
  ResolveTest: true,
  MaxDepth: 10,
}


err := t.Resolve("strings")

Author

depth was developed by Kyle Banks.

License

depth is available under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].