util

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ResolveCurrent = false

ResolveCurrent selects whether the package should only the dependencies for the current OS/ARCH instead of all possible permutations. This is not concurrently safe which is ok for the current application. If other needs arise it may need to be re-written.

Functions

func GetRootFromPackage

func GetRootFromPackage(pkg string) string

GetRootFromPackage retrives the top level package from a name.

From a package name find the root repo. For example, the package github.com/Masterminds/cookoo/io has a root repo at github.com/Masterminds/cookoo

func NormalizeName

func NormalizeName(name string) (string, string)

NormalizeName takes a package name and normalizes it to the top level package.

For example, golang.org/x/crypto/ssh becomes golang.org/x/crypto. 'ssh' is returned as extra data.

FIXME: Is this deprecated?

Types

type BuildCtxt

type BuildCtxt struct {
	build.Context
}

BuildCtxt is a convenience wrapper for not having to import go/build anywhere else

func GetBuildContext

func GetBuildContext() (*BuildCtxt, error)

GetBuildContext returns a build context from go/build. When the $GOROOT variable is not set in the users environment it sets the context's root path to the path returned by 'go env GOROOT'.

TODO: This should be moved to the `dependency` package.

func (*BuildCtxt) PackageName

func (b *BuildCtxt) PackageName(base string) string

PackageName attempts to determine the name of the base package.

If resolution fails, this will return "main".

Jump to

Keyboard shortcuts

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