Documentation
¶
Index ¶
- Constants
- Variables
- func BuildPath(baseDir string, pkg *build.Package) string
- func ExitCode(err error) (int, error)
- func GitDir(value string) string
- func InstallPath(pkg *build.Package) string
- func QuoteCommand(command string, args []string) string
- type BuildArger
- type Context
- func (ctx *Context) DirToImportPath(dir string) string
- func (ctx *Context) ExpandEllipsis(args ...string) []string
- func (ctx *Context) GoExec(args ...string) error
- func (ctx Context) Import(path, srcDir string) (*build.Package, error)
- func (ctx *Context) ImportPathToDir(importPath string) string
- func (ctx *Context) ImportPathToProjectDir(importPath string) string
- func (ctx *Context) NoGoImportPathToProjectImportPaths(importPath string) []string
- func (ctx *Context) NormalizeImportPath(importPath string) string
- func (ctx *Context) Touch(path string) error
Constants ¶
const ( ExitOK = iota ExitFailed ExitSignaled = 98 + iota ExitStopped ExitContinued ExitCoreDump )
Variables ¶
var CWD string
Functions ¶
func GitDir ¶
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 QuoteCommand ¶
Types ¶
type BuildArger ¶
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 (*Context) ExpandEllipsis ¶
func (Context) Import ¶
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.