gopathwalk

package
v0.0.0-...-f5fa625 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2021 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Walk

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.

func WalkSkip

func WalkSkip(roots []Root, add func(root Root, dir string), skip func(root Root, dir string) bool, opts Options)

WalkSkip 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. For each directory that will be scanned, skip will be called (concurrently) with the absolute paths of the containing source directory and the directory. If skip returns false on a directory it will be processed. add will be called concurrently. skip will be called concurrently.

Types

type Options

type Options struct {
	// If Logf is non-nil, debug logging is enabled through this function.
	Logf func(format string, args ...interface{})
	// Search module caches. Also disables legacy goimports ignore rules.
	ModulesEnabled bool
}

Options controls the behavior of a Walk call.

type Root

type Root struct {
	Path string
	Type RootType
}

A Root is a starting point for a Walk.

type RootType

type RootType int

RootType indicates the type of a Root.

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

Jump to

Keyboard shortcuts

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