govname

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2016 License: Apache-2.0 Imports: 5 Imported by: 3

Documentation

Overview

Package govname supports the creation of VName protobuf messages for Go packages and other entities.

Index

Constants

View Source
const Language = "go"

Language is the language string to use for Go VNames.

Variables

View Source
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

func ForBuiltin(signature string) *spb.VName

ForBuiltin returns a VName for a Go built-in with the given signature.

func ForPackage

func ForPackage(corpus string, pkg *build.Package) *spb.VName

ForPackage returns a VName for a Go package.

A package VName has the fixed signature ":pkg:", 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 IsStandardLibrary added in v0.0.14

func IsStandardLibrary(v *spb.VName) bool

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.

Jump to

Keyboard shortcuts

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