cache

package
v0.0.0-...-76bcd77 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2019 License: MIT Imports: 28 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const BuiltinPkg = "builtin"

BuiltinPkg builtin package

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheStyle

type CacheStyle string
const (
	None     CacheStyle = "none"
	Ondemand CacheStyle = "on-demand"
	Always   CacheStyle = "always"
)

type File

type File struct {
	// contains filtered or unexported fields
}

File holds all the information we know about a file.

func (*File) GetAST

func (f *File) GetAST(ctx context.Context) *ast.File

func (*File) GetContent

func (f *File) GetContent(ctx context.Context) []byte

GetContent returns the contents of the file, reading it from file system if needed.

func (*File) GetFileSet

func (f *File) GetFileSet(ctx context.Context) *token.FileSet

func (*File) GetPackage

func (f *File) GetPackage(ctx context.Context) source.Package

func (*File) GetToken

func (f *File) GetToken(ctx context.Context) *token.File

func (*File) URI

func (f *File) URI() span.URI

type FindPackageFunc

type FindPackageFunc func(project *Project, importPath string) (source.Package, error)

FindPackageFunc matches the signature of loader.Config.FindPackage, except also takes a context.Context.

type GlobalCache

type GlobalCache struct {
	// contains filtered or unexported fields
}

PackageCache package cache

func NewCache

func NewCache() *GlobalCache

NewCache new a package cache

func (*GlobalCache) Add

func (c *GlobalCache) Add(pkg *packages.Package)

func (*GlobalCache) Delete

func (c *GlobalCache) Delete(id string)

func (*GlobalCache) Get

func (c *GlobalCache) Get(pkgPath string) *GlobalPackage

Get get package by package import path from global cache

func (*GlobalCache) GetByURI

func (c *GlobalCache) GetByURI(filename string) *Package

GetByURI get package by filename from global cache

func (*GlobalCache) Lock

func (c *GlobalCache) Lock()

func (*GlobalCache) Put

func (c *GlobalCache) Put(pkg *Package)

func (*GlobalCache) RLock

func (c *GlobalCache) RLock()

func (*GlobalCache) RUnlock

func (c *GlobalCache) RUnlock()

func (*GlobalCache) Unlock

func (c *GlobalCache) Unlock()

func (*GlobalCache) Walk

func (c *GlobalCache) Walk(walkFunc source.WalkFunc, ranks []string) error

Walk walk the global package cache

type GlobalPackage

type GlobalPackage struct {
	// contains filtered or unexported fields
}

func (*GlobalPackage) ModTime

func (p *GlobalPackage) ModTime() time.Time

func (*GlobalPackage) Package

func (p *GlobalPackage) Package() *Package

type Observer

type Observer interface {
	// contains filtered or unexported methods
}

type Package

type Package struct {
	// contains filtered or unexported fields
}

Package contains the type information needed by the source package.

func (*Package) GetActionGraph

func (pkg *Package) GetActionGraph(ctx context.Context, a *analysis.Analyzer) (*source.Action, error)

func (*Package) GetErrors

func (pkg *Package) GetErrors() []packages.Error

func (*Package) GetFileSet

func (pkg *Package) GetFileSet() *token.FileSet

func (*Package) GetFilenames

func (pkg *Package) GetFilenames() []string

func (*Package) GetImport

func (pkg *Package) GetImport(pkgPath string) source.Package

func (*Package) GetName

func (pkg *Package) GetName() string

func (*Package) GetPkgPath

func (pkg *Package) GetPkgPath() string

func (*Package) GetSyntax

func (pkg *Package) GetSyntax() []*ast.File

func (*Package) GetTypes

func (pkg *Package) GetTypes() *types.Package

func (*Package) GetTypesInfo

func (pkg *Package) GetTypesInfo() *types.Info

func (*Package) IsIllTyped

func (pkg *Package) IsIllTyped() bool

type Project

type Project struct {
	// contains filtered or unexported fields
}

Project project struct

func NewProject

func NewProject(ctx context.Context, conn jsonrpc2.JSONRPC2, rootPath string, buildFlags []string) *Project

NewProject new project

func (*Project) Cache

func (p *Project) Cache() *GlobalCache

func (*Project) Contain

func (p *Project) Contain(fileURI lsp.DocumentURI) bool

func (*Project) GetBuiltinPackage

func (p *Project) GetBuiltinPackage() source.Package

GetBuiltinPackage get builtin package

func (*Project) GetFromPkgPath

func (p *Project) GetFromPkgPath(pkgPath string) source.Package

GetFromPkgPath get package from package import path.

func (*Project) GetFromURI

func (p *Project) GetFromURI(uri lsp.DocumentURI) source.Package

GetFromURI get package from document uri.

func (*Project) Init

func (p *Project) Init(ctx context.Context, globalCacheStyle CacheStyle) error

Init init project

func (*Project) Search

func (p *Project) Search(walkFunc source.WalkFunc) error

Search serach package cache

func (*Project) TypeCheck

func (p *Project) TypeCheck(ctx context.Context, fileURI lsp.DocumentURI) (source.Package, source.File, error)

func (*Project) View

func (p *Project) View() source.View

type Subject

type Subject interface {
	// contains filtered or unexported methods
}

type View

type View struct {

	// Config is the configuration used for the view's interaction with the
	// go/packages API. It is shared across all views.
	Config packages.Config
	// contains filtered or unexported fields
}

func NewView

func NewView(config *packages.Config) *View

func (*View) BackgroundContext

func (v *View) BackgroundContext() context.Context

func (*View) FileSet

func (v *View) FileSet() *token.FileSet

func (*View) GetFile

func (v *View) GetFile(ctx context.Context, uri span.URI) (source.File, error)

GetFile returns a File for the given URI. It will always succeed because it adds the file to the managed set if needed.

func (*View) SetContent

func (v *View) SetContent(ctx context.Context, uri span.URI, content []byte) error

SetContent sets the overlay contents for a file.

Jump to

Keyboard shortcuts

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