packages

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package packages implements support for loading packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Module added in v0.3.0

type Module struct {
	Path     string     // module path
	Version  string     // module version
	Time     *time.Time // time version was created
	Dir      string     // directory holding files for this module, if any
	Packages []*Package // packages belonging to the module

}

A Module describes a package's containing module.

func LoadModule added in v0.3.0

func LoadModule(pattern string) (*Module, error)

LoadModule loads and return the module named by pattern and all its packages.

func (*Module) Date added in v0.3.0

func (m *Module) Date() string

Date returns the date when the module version was created, or the current date if it is not available.

func (*Module) String added in v0.3.0

func (m *Module) String() string

String implements the Stringer interface.

type Package

type Package struct {
	Dir        string  // directory containing package sources
	ImportPath string  // import path of package in dir
	Name       string  // package name
	Module     *Module // info about package's containing module, if any (can be nil)

	// Source files
	GoFiles        []string // .go source files (excluding CgoFiles, TestGoFiles, XTestGoFiles)
	CgoFiles       []string // .go sources files that import "C"
	IgnoredGoFiles []string // .go sources ignored due to build constraints

	// Test information
	TestGoFiles  []string // _test.go files in package
	XTestGoFiles []string // _test.go files outside package
}

A Package describes a single package found in a directory.

func Load

func Load(pattern string) (*Package, error)

Load loads and return the package named by the given pattern.

If more than one package matches the pattern, only the first one is returned.

Load returns at least one package or an error.

func (*Package) SourceFiles

func (p *Package) SourceFiles() []string

SourceFiles returns all the .go files, including files ignored due to build constraints.

func (*Package) String added in v0.3.0

func (p *Package) String() string

String implements the Stringer interface.

func (*Package) TestFiles

func (p *Package) TestFiles() []string

TestFiles returns all the _test.go files.

Jump to

Keyboard shortcuts

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