gopkgs: Index | Files | Directories

package gopkgs

import ""


Package Files


func Packages Uses

func Packages(opt *Option) []*Pkg

Packages returns all importable Go packages. Packages uses []( implementation internally, so it's fast. e.g. it cares .goimportsignore

type Option Uses

type Option struct {
    // Fill package name in Pkg struct if it's true. Note that it needs to parse
    // package directory to get package name and it takes some costs.
    IncludeName bool

func DefaultOption Uses

func DefaultOption() *Option

type Pkg Uses

type Pkg struct {
    Dir             string // absolute file path to Pkg directory ("/usr/lib/go/src/net/http")
    ImportPath      string // full Pkg import path ("net/http", "foo/bar/vendor/a/b")
    ImportPathShort string // vendorless import path ("net/http", "a/b")

    // It can be empty. It's filled only when Option.IncludeName is true.
    Name string // package name ("http")

Pkg represents exported go packages. It's based on x/tools/imports.Pkg.



Package gopkgs imports 6 packages (graph). Updated 2017-10-03. Refresh now. Tools for package owners.