resolve

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ImportPathToBazelRepoName

func ImportPathToBazelRepoName(importpath string) string

ImportPathToBazelRepoName converts a Go import path into a bazel repo name following the guidelines in http://bazel.io/docs/be/functions.html#workspace

func IsStandard added in v0.7.0

func IsStandard(imp string) bool

IsStandard returns whether a package is in the standard library.

Types

type Label

type Label struct {
	Repo, Pkg, Name string
	Relative        bool
}

A Label represents a label of a build target in Bazel.

func (Label) String

func (l Label) String() string

type Labeler added in v0.5.4

type Labeler interface {
	LibraryLabel(rel string) Label
	TestLabel(rel string, isXTest bool) Label
	BinaryLabel(rel string) Label
	ProtoLabel(rel, name string) Label
	GoProtoLabel(rel, name string) Label
}

Labeler generates Bazel labels for rules, based on their locations within the repository.

func NewLabeler added in v0.5.4

func NewLabeler(c *config.Config) Labeler

type Resolver added in v0.5.4

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. TODO(#859): imports are currently resolved by guessing a label based on the name. We should be smarter about this and build a table mapping import paths to labels that we can use to cross-reference.

func NewResolver added in v0.5.4

func NewResolver(c *config.Config, l Labeler) *Resolver

func (*Resolver) ResolveGo added in v0.6.0

func (r *Resolver) ResolveGo(imp, pkgRel string) (Label, error)

ResolveGo resolves an import path from a Go source file to a label. pkgRel is the path to the Go package relative to the repository root; it is used to resolve relative imports.

func (*Resolver) ResolveGoProto added in v0.6.0

func (r *Resolver) ResolveGoProto(imp, pkgRel string) (Label, error)

ResolveGoProto resolves an import statement in a .proto file to a label for a go_library rule that embeds the corresponding go_proto_library.

func (*Resolver) ResolveProto added in v0.6.0

func (r *Resolver) ResolveProto(imp, pkgRel string) (Label, error)

ResolveProto resolves an import statement in a .proto file to a label for a proto_library rule.

Directories

Path Synopsis
internal
gen_std_package_list
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