Documentation ¶
Index ¶
- func IsMultiplePackage(err error) bool
- func IsNoBuildableGo(err error) bool
- func IsNoGo(err error) bool
- type Context
- func (c *Context) Context() *build.Context
- func (c *Context) GOPATH() string
- func (c *Context) GOROOT() string
- func (c *Context) MatchFile(dir, name string) bool
- func (c *Context) PkgTargetRoot(path string) (pkgRoot string, pkgA string, err error)
- func (c *Context) SetGoPath(s string)
- func (c *Context) SetGoRoot(s string)
- func (c *Context) SrcDirs() []string
- func (c *Context) Update()
- type Corpus
- type DirEntry
- type DirList
- type Directory
- type Event
- type EventType
- type Eventer
- type File
- type FileMap
- type GoFileType
- type Ident
- type Index
- type IndexEvent
- type MultiplePackageError
- type NoBuildableGoError
- type NoGoError
- type Package
- func (p *Package) Error() error
- func (p *Package) FileNames(typ GoFileType) []string
- func (p *Package) FilePaths(typ GoFileType) []string
- func (p *Package) Files(typ GoFileType) []File
- func (p *Package) GoFiles() []string
- func (p *Package) IsCommand() bool
- func (p *Package) IsValid() bool
- func (p *Package) LookupFile(name string) (File, bool)
- type PackageIndex
- type TypInfo
- type TypKind
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsMultiplePackage ¶
Returns, if the error err is MultiplePackageError error.
func IsNoBuildableGo ¶
Returns, if the error err is NoBuildableGoError error.
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
A Context provides safe-concurrent access to a build.Context, that optionally checks for changes to Go specific environment variables (GOROOT, GOPATH).
func NewContext ¶
NewContext, returns a new Context for build.Context ctxt with an update interval of updateInterval. If updateInterval is less than or equal to zero the returned Context will not check the environment for changes to GOROOT and GOPATH.
If ctxt is nil, build.Default and the current GOROOT and GOPATH are used.
func (*Context) Context ¶
Context returns a pointer the the current build.Context. The returned *build.Context should *not* be modified by the reciever.
func (*Context) MatchFile ¶
MatchFile reports whether the file with the given name in the given directory matches the context and would be included in a Package created by ImportDir of that directory.
MatchFile considers the name of the file and may use ctxt.OpenFile to read some or all of the file's content.
See: go/build/build.go Context.MatchFile for more information.
func (*Context) PkgTargetRoot ¶
PkgTargetRoot, returns the package directory and package .a file for the Go package named by the import path and the current context.
See: go/build/build.go Import() for more information.
type Corpus ¶
type Corpus struct { MaxDepth int LogEvents bool IndexGoCode bool IndexThrottle float64 IndexInterval time.Duration // contains filtered or unexported fields }
type DirEntry ¶
type DirEntry struct { Depth int // >= 0 Height int // = DirList.MaxHeight - Depth, > 0 Path string // directory path; includes Name, relative to DirList root Name string // directory name PkgName string // package name, or "" if none HasPkg bool // true if the directory contains at least one package Internal bool // true if the package is an "internal" package }
type File ¶
type FileMap ¶
A FileMap is a map of related files.
type GoFileType ¶
type GoFileType int
A GoFileType describes a Go file in a package directory.
const ( IgnoredGoFile GoFileType = 1 + iota // .go source files (excluding TestGoFiles and IgnoredGoFiles) TestGoFile // .go source files ignored for this build GoFile // _test.go files in package (build tags are not checked) )
func (GoFileType) IsValid ¶
func (t GoFileType) IsValid() bool
func (GoFileType) String ¶
func (t GoFileType) String() string
type Ident ¶
type Ident struct { Name string // Type, func or type.method name Package string // Package name "http" Path string // Package path "net/http" File string // File where declared "$GOROOT/src/net/http/server.go" Info TypInfo // Type and position info }
func (*Ident) IsExported ¶
IsExported reports whether the Ident is an exported Go symbol.
type IndexEvent ¶
type IndexEvent struct {
// contains filtered or unexported fields
}
func (IndexEvent) Callback ¶
func (e IndexEvent) Callback(c *Corpus) error
func (IndexEvent) Event ¶
func (e IndexEvent) Event() EventType
func (IndexEvent) String ¶
func (e IndexEvent) String() string
type MultiplePackageError ¶
type MultiplePackageError struct { Dir string // directory containing files Packages []string // package names found Files []string // corresponding files: Files[i] declares package Packages[i] }
MultiplePackageError describes a directory containing multiple buildable Go source files for multiple packages.
func (*MultiplePackageError) Error ¶
func (e *MultiplePackageError) Error() string
type NoBuildableGoError ¶
type NoBuildableGoError struct {
Dir string
}
NoGoError is the error used by Import to describe a directory containing no buildable Go source files. (It may still contain test files, files hidden by build tags, and so on.)
func (*NoBuildableGoError) Error ¶
func (e *NoBuildableGoError) Error() string
type NoGoError ¶
type NoGoError struct {
Dir string
}
NoGoError is the error used by Import to describe a directory containing no Go source files.
type Package ¶
type Package struct { Dir string // Directory path "$GOROOT/src/net/http" Name string // Package name "http" ImportPath string // Import path of package "net/http" Root string // Root of Go tree where this package lives SrcRoot string // package source root directory Goroot bool // Package found in Go root Installed bool // True if the package or command is installed Info os.FileInfo // File info as of last update // contains filtered or unexported fields }
A Package describes a Go package or command.
func (*Package) FileNames ¶
func (p *Package) FileNames(typ GoFileType) []string
FileNames, returns the names of files that match GoFileType typ. If GoFileType typ is less than zero all files are matched.
func (*Package) FilePaths ¶
func (p *Package) FilePaths(typ GoFileType) []string
FilePaths, returns the paths of files that match GoFileType typ. If GoFileType typ is less than zero all files are matched.
func (*Package) Files ¶
func (p *Package) Files(typ GoFileType) []File
File, returns the files that match GoFileType typ. If GoFileType typ is less than zero all files are matched.
type PackageIndex ¶
type PackageIndex struct {
// contains filtered or unexported fields
}
func (*PackageIndex) ImportDir ¶
func (x *PackageIndex) ImportDir(dir string) (*Package, error)
TODO: Remove if unused.
func (*PackageIndex) InvalidateContext ¶
func (x *PackageIndex) InvalidateContext(matchFiles bool)
func (*PackageIndex) UpdatePackage ¶
func (x *PackageIndex) UpdatePackage(p *Package) (*Package, error)
type TypInfo ¶
type TypInfo uint64
A TypeInfo value describes a particular identifier spot in a given file. It encodes three values: the TypeKind, and the file line and offset.
The following encoding is used:
bits 64 32 4 1 value [offset|line|kind]
TODO (CEV): Add line offset.
func (TypInfo) MarshalJSON ¶
func (*TypInfo) UnmarshalJSON ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package fs provides file-system utilities and an implementation of os.FileInfo that implements the GobEncode, GobDecode, MarshalJSON and UnmarshalJSON interfaces.
|
Package fs provides file-system utilities and an implementation of os.FileInfo that implements the GobEncode, GobDecode, MarshalJSON and UnmarshalJSON interfaces. |