Documentation ¶
Overview ¶
Package govname supports the creation of VName protobuf messages for Go packages and other entities.
Index ¶
Constants ¶
const Language = "go"
Language is the language string to use for Go VNames.
Variables ¶
var VCSRules = vnameutil.Rules{{ regexp.MustCompile(`^(?i)(?P<corpus>code\.google\.com/p/[-a-z0-9]+)(?:\.(?P<subrepo>\w+))?` + pathTail), &spb.VName{Corpus: "${corpus}", Path: "${path}", Signature: packageSig, Root: "${subrepo}"}, }, { regexp.MustCompile(`^(?i)(?P<corpus>[-._a-z0-9]+\.googlecode\.com)` + pathTail), &spb.VName{Corpus: "${corpus}", Path: "${path}", Signature: packageSig}, }, { regexp.MustCompile(`^(?P<corpus>github\.com(?:/[-.\w]+){2})` + pathTail), &spb.VName{Corpus: "${corpus}", Path: "${path}", Signature: packageSig}, }, { regexp.MustCompile(`^(?P<corpus>bitbucket\.org(?:/[-.\w]+){2})` + pathTail), &spb.VName{Corpus: "${corpus}", Path: "${path}", Signature: packageSig}, }, { regexp.MustCompile(`^(?P<corpus>launchpad\.net/(?:[-.\w]+|~[-.\w]+/[-.\w]+))` + pathTail), &spb.VName{Corpus: "${corpus}", Path: "${path}", Signature: packageSig}, }, { regexp.MustCompile(`(?P<corpus>golang\.org(?:/x/\w+))` + pathTail), &spb.VName{Corpus: "${corpus}", Path: "${path}", Signature: packageSig}, }, }
VCSRules defines rewriting rules for Go import paths, using rules loosely borrowed from $GOROOT/src/cmd/go/vcs.go. These rules are used to extract corpus and root information from an import path.
Functions ¶
func ForBuiltin ¶ added in v0.0.21
ForBuiltin returns a VName for a Go built-in with the given signature.
func ForPackage ¶
ForPackage returns a VName for a Go package.
A package VName has the fixed signature "package", and the VName path holds the import path relative to the corpus root. The VCSRules are used to identify the corpus; if none apply then by default the first path component of the import path is used as the corpus name, except for packages under GOROOT which are attributed to the special corpus "golang.org".
func ForStandardLibrary ¶ added in v0.0.27
ForStandardLibrary returns a VName for a standard library package with the given import path.
func IsStandardLibrary ¶ added in v0.0.14
IsStandardLibrary reports whether v names part of the Go standard library. This includes the "golang.org" corpus but excludes the "golang.org/x/..." extension repositories. If v == nil, the answer is false.
Types ¶
This section is empty.