zbcontext

package
v0.0.0-...-83f582a Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2017 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExitOK = iota
	ExitFailed
	ExitSignaled = 98 + iota
	ExitStopped
	ExitContinued
	ExitCoreDump
)

Variables

Functions

func BuildPath

func BuildPath(baseDir string, pkg *build.Package) string

func ExitCode

func ExitCode(err error) (int, error)

func GitDir

func GitDir(value string) string

GitDir checks the directory value for the presence of .git and will walk up the filesystem hierarchy to find one. Returns an empty string if no directory containing .git was found.

func InstallPath

func InstallPath(pkg *build.Package) string

func QuoteCommand

func QuoteCommand(command string, args []string) string

Types

type BuildArger

type BuildArger interface {
	BuildArgs(*build.Package, *plumbing.Hash) []string
	RebuildAll() bool
}

type Context

type Context struct {
	Logger               slog.Interface
	GitCommit, BuildDate *string
	NoWarnTodoFixme      bool
	CacheDir             string
	Package              bool
	BuildContext         *build.Context
	BuildArger
	NoGenerate bool

	ExcludeVendor bool
}

Context for package related commands

func (*Context) DirToImportPath

func (ctx *Context) DirToImportPath(dir string) string

func (*Context) ExpandEllipsis

func (ctx *Context) ExpandEllipsis(args ...string) []string

func (*Context) GoExec

func (ctx *Context) GoExec(args ...string) error

func (Context) Import

func (ctx Context) Import(path, srcDir string) (*build.Package, error)

Import returns details about the Go package named by the import path, interpreting local import paths relative to the srcDir directory. If the path is a local import path naming a package that can be imported using a standard import path, the returned package will set p.ImportPath to that path.

In the directory containing the package, .go, .c, .h, and .s files are considered part of the package except for:

  • .go files in package documentation
  • files starting with _ or . (likely editor temporary files)
  • files with build constraints not satisfied by the context

If an error occurs, Import returns a non-nil error and a non-nil *Package containing partial information.

func (*Context) ImportPathToDir

func (ctx *Context) ImportPathToDir(importPath string) string

func (*Context) ImportPathToProjectDir

func (ctx *Context) ImportPathToProjectDir(importPath string) string

func (*Context) NoGoImportPathToProjectImportPaths

func (ctx *Context) NoGoImportPathToProjectImportPaths(importPath string) []string

func (*Context) NormalizeImportPath

func (ctx *Context) NormalizeImportPath(importPath string) string

func (*Context) Touch

func (ctx *Context) Touch(path string) error

Jump to

Keyboard shortcuts

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