gopathwalk

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2022 License: Apache-2.0 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.

Types

type Options

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

type Root struct {
	Path string
	Type RootType
}

A Root is a starting point for a Walk.

func SrcDirsRoots

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

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

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