Documentation

Overview

Package imports scans for Go package import paths.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(pkgs []string, format string) ([]byte, error)

Format takes a slice of packages and formats it.

func Parse

func Parse(file string) ([]string, error)

Parse takes a Go file path and parses its import paths.

func Path

func Path(dir string) (string, error)

Path returns the import path of a package directory. It does so via $GOPATH.

func Scan

func Scan(path string, options ...ScanOptions) ([]string, error)

Scan takes a directory and scans it for import dependencies.

func Valid

func Valid(path string) bool

Valid takes an import package path and determines if its valid.

Types

type ScanOptions

type ScanOptions int

ScanOptions represents available scan options.

const (
	// SinglePackage only scans a single package
	SinglePackage ScanOptions = iota

	// SkipTestFiles does not scan files that end in "_test.go".
	SkipTestFiles

	// SkipFilters returns the raw unfiltered list of scanned packages.
	SkipFilters
)

func ParseOptions

func ParseOptions(skipTestFiles, skipFilters bool) []ScanOptions

ParseOptions converts cli flag inputs to ScanOptions.

Directories

Path Synopsis
filters Package filters provides filters for Go package import paths.