gobin-info

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2023 License: AGPL-3.0 Imports: 16 Imported by: 0

README

gobin-info

gobin-info lists your locally installed Go binaries alongside their version and original Git repository.

It's kind of like a convenience wrapper around go version -m ... with some niceties on top, like vanity URL resolving.

Installation

go install github.com/philippgille/gobin-info@latest

Usage

You can run gobin-info in several modes:

  • gobin-info /path/to/dir lists info about the Go binaries in a given directory (relative or absolute)
  • gobin-info -wd lists info about the Go binaries in your working directory
  • gobin-info -gobin lists info about the Go binaries in your $GOBIN directory
  • gobin-info -gopath lists info about the Go binaries in your $GOPATH/bin directory
  • 🚧 gobin-info -path lists info about the Go binaries in your $PATH (not implemented yet)

It prints a (❓) after the URL in case the URL couldn't be reliably determined.

Note: gobin-info doesn't recurse into subdirectories. This might be added with an optional flag in the future.

Example
$ gobin-info -gopath
Scanning /home/johndoe/go/bin
arc         v3.5.1  https://github.com/mholt/archiver
gopls       v0.11.0 https://go.googlesource.com/tools
mage        (devel) https://github.com/magefile/mage
staticcheck v0.3.3  https://github.com/dominikh/go-tools

Raison d'être

Most of your CLI tools were probably installed with a package manager like apt or dnf on Linux, Homebrew on macOS, or Scoop on Windows. Then if you want to get the list of your installed tools, you can run apt list --installed, brew list or scoop list to list them, and if you want to know more about one of them you can run apt show ..., brew info ... or scoop info ....

But what about the ones you installed with Go? You installed them with go install ... and they live in $GOPATH/bin or $GOBIN or maybe you move/symlink them to /usr/local/bin or so. But you don't immediately know the origin of the tools. For example if there's a binary called arc, it could be github.com/mholt/archiver/v3/cmd/arc or github.com/evilsocket/arc/cmd/arc for example. You could run arc --help and it might give a hint what exactly it is. Or you run go version -m /path/to/arc and among the dozens of output lines you check the path or mod line for the GitHub repo. But it's not a proper URL so it's probably not clickable in your terminal. And it might be a vanity path like gopkg.in/..., so not pointing to the original Git repository.

gobin-info makes all of this much easier.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL