tools: golang.org/x/tools/internal/gopathwalk Index | Files

package gopathwalk

import "golang.org/x/tools/internal/gopathwalk"

Package gopathwalk is like filepath.Walk but specialized for finding Go packages, particularly in $GOPATH and $GOROOT.

Index

Package Files

walk.go

func Walk Uses

func Walk(roots []Root, add func(root Root, dir string), opts Options)

Walk walks Go source directories ($GOROOT, $GOPATH, etc) to find packages. For each package found, add will be called (concurrently) with the absolute paths of the containing source directory and the package directory. add will be called concurrently.

type Options Uses

type Options struct {
    Debug          bool // Enable debug logging
    ModulesEnabled bool // Search module caches. Also disables legacy goimports ignore rules.
}

Options controls the behavior of a Walk call.

type Root Uses

type Root struct {
    Path string
    Type RootType
}

A Root is a starting point for a Walk.

func SrcDirsRoots Uses

func SrcDirsRoots(ctx *build.Context) []Root

SrcDirsRoots returns the roots from build.Default.SrcDirs(). Not modules-compatible.

type RootType Uses

type RootType int

RootType indicates the type of a Root.

const (
    RootUnknown RootType = iota
    RootGOROOT
    RootGOPATH
    RootCurrentModule
    RootModuleCache
    RootOther
)

Package gopathwalk imports 10 packages (graph) and is imported by 3 packages. Updated 2019-07-15. Refresh now. Tools for package owners.