github.com/Masterminds/godir

Go Path Tool: A utility for working with Go and filesystem paths.


License
Other
Install
go get github.com/Masterminds/godir

Documentation

godir: The Go Directory Tool

godir is a tool for working with Go source files in a Go-sensitive way. It is designed to make it easier for you to work with Go operations.

This is a tool to help with your...

  • Shell scripting
  • Makefiles
  • TravisCI, CircleCI, and build pipeline config
  • Daily life

Usage

Run tests while ignoring vendor/

$ go test $(godir pkgs)

Or for path-aware tools:

$ golint $(godir paths)
$ go tool vet $(godir paths)

More

With a multi-path $GOPATH, find which path the current package is on:

⇒  godir gopath
/Users/mbutcher/Code/Go

Get the name of the current package, even with a compound $GOPATH:

⇒  godir name
github.com/Masterminds/glide

Get a list of subpackages in the project with godir pkgs. Note that this only returns packages that have source files (not including tests).

⇒  godir pkgs
github.com/Masterminds/glide/action
github.com/Masterminds/glide/cfg
github.com/Masterminds/glide/dependency
github.com/Masterminds/glide/gb
github.com/Masterminds/glide/godep
github.com/Masterminds/glide/gpm
github.com/Masterminds/glide/importer
github.com/Masterminds/glide/msg
github.com/Masterminds/glide/path
github.com/Masterminds/glide/repo
github.com/Masterminds/glide/tree
github.com/Masterminds/glide/util

Or if you want to work with paths instead:

⇒  godir paths
/Users/mbutcher/Code/Go/src/github.com/Masterminds/glide/action
/Users/mbutcher/Code/Go/src/github.com/Masterminds/glide/cfg
/Users/mbutcher/Code/Go/src/github.com/Masterminds/glide/dependency
/Users/mbutcher/Code/Go/src/github.com/Masterminds/glide/docs
/Users/mbutcher/Code/Go/src/github.com/Masterminds/glide/gb
/Users/mbutcher/Code/Go/src/github.com/Masterminds/glide/godep
/Users/mbutcher/Code/Go/src/github.com/Masterminds/glide/gpm
/Users/mbutcher/Code/Go/src/github.com/Masterminds/glide/importer
/Users/mbutcher/Code/Go/src/github.com/Masterminds/glide/msg
/Users/mbutcher/Code/Go/src/github.com/Masterminds/glide/path
/Users/mbutcher/Code/Go/src/github.com/Masterminds/glide/repo
/Users/mbutcher/Code/Go/src/github.com/Masterminds/glide/tree
/Users/mbutcher/Code/Go/src/github.com/Masterminds/glide/util

Note that this does not restrict to only paths with source!

Installation

$ go get github.com/Masterminds/godir

For development:

$ git clone THIS_REPO
$ glide install