resolve

package
v0.0.0-...-c02bc0f Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsStandard

func IsStandard(imp string) bool

IsStandard returns whether a package is in the standard library.

Types

type Resolver

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

Resolver resolves import strings in source files (import paths in Go, import statements in protos) into Bazel labels.

func NewResolver

func NewResolver(c *config.Config, l *label.Labeler, ix *RuleIndex, rc *repos.RemoteCache) *Resolver

func (*Resolver) ResolveRule

func (r *Resolver) ResolveRule(e bf.Expr, pkgRel string) bf.Expr

ResolveRule copies and modifies a generated rule e by replacing the import paths in the "_gazelle_imports" attribute with labels in a "deps" attribute. This may be safely called on expressions that aren't Go rules (the original expression will be returned). Any existing "deps" attribute is deleted, so it may be necessary to merge the result.

type RuleIndex

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

RuleIndex is a table of rules in a workspace, indexed by label and by import path. Used by Resolver to map import paths to labels.

func NewRuleIndex

func NewRuleIndex() *RuleIndex

func (*RuleIndex) AddRulesFromFile

func (ix *RuleIndex) AddRulesFromFile(c *config.Config, file *bf.File)

AddRulesFromFile adds existing rules to the index from file (which must not be nil).

func (*RuleIndex) Finish

func (ix *RuleIndex) Finish()

Finish constructs the import index and performs any other necessary indexing actions after all rules have been added. This step is necessary because a rule may be indexed differently based on what rules are added later.

This function must be called after all AddRulesFromFile calls but before any findRuleByImport calls.

Directories

Path Synopsis
gen_std_package_list reads a text file containing a list of packages (one per line) and generates a .go file containing a set of package names.
gen_std_package_list reads a text file containing a list of packages (one per line) and generates a .go file containing a set of package names.

Jump to

Keyboard shortcuts

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