Versions in this module Expand all Collapse all v0 v0.14.0 Apr 24, 2024 v0.13.0 Feb 27, 2024 Changes in this version + const ModulePath + const TagFlagRequired + const TagFlagSeparator + const TagKeyDescription + const TagKeyFlag + var GlobalArgs = Global + var ShCmdLogDisabled bool + func BindJsonFile(bind interface{}, filepath string, additionalLookupDirs ...string) (string, error) + func BindYaml(reader io.Reader, bind interface{}) error + func BindYamlFile(bind interface{}, filepath string, additionalLookupDirs ...string) (string, error) + func DefaultOutputDir() string + func DefaultTemporaryDir() string + func DefaultWorkingDir() string + func DropReplace(ctx context.Context, module string, version string, opts ...GoCmdOptions) error + func DropRequire(ctx context.Context, module string, opts ...GoCmdOptions) error + func FindGitRepoRoot(path string) (string, error) + func FindPackages(ctx context.Context, opts []GoCmdOptions, modules ...string) (map[string]*GoPackage, error) + func GenerateFileWithOption(ctx context.Context, opt *TemplateOption) error + func GoCommandDecodeJson(ctx context.Context, model interface{}, opts ...ShCmdOptions) (ret []interface{}, err error) + func GoGet(ctx context.Context, module string, versionQuery string, opts ...GoCmdOptions) error + func GoModTidy(ctx context.Context, extraShellOptions []ShCmdOptions, opts ...GoCmdOptions) error + func IsGitRepoRoot(path string) bool + func IsLocalPackageExists(ctx context.Context, pkgPath string) (bool, error) + func LoadYamlConfig(bind interface{}, filepath string, additionalLookupDirs ...string) error + func LocalFlags(cmd *cobra.Command, value interface{}) + func LookupFile(filePath string, additionalLookupDirs ...string) (absPath string, file *os.File, err error) + func LookupFiles(pattern string, dirs ...string) (absPaths []string, err error) + func MatchPathPattern(pattern, path string) (bool, error) + func MatchPrefix(prefix, value string, caseInsensitive bool) (bool, error) + func MatchRegex(regex, value string) (bool, error) + func MatchRegexPattern(regex *regexp.Regexp, value string) (bool, error) + func MatchString(expected, actual string, caseInsensitive bool) bool + func MatchSubString(substr, actual string, caseInsensitive bool) bool + func MatchSuffix(suffix, value string, caseInsensitive bool) (bool, error) + func OpenFile(filePath string, flag int, perm os.FileMode) (absPath string, file *os.File, err error) + func PackageImportPathCache(ctx context.Context) map[string]*GoPackage + func PathRelativeToModuleDir(relativePath string) string + func PersistentFlags(cmd *cobra.Command, value interface{}) + func RestoreInvalidReplace(ctx context.Context, replaces []*Replace, opts ...GoCmdOptions) error + func RunShellCommands(ctx context.Context, opts ...ShCmdOptions) (uint8, error) + func SetReplace(ctx context.Context, replaces []*Replace, opts ...GoCmdOptions) error + type AndMatcher []Matcher[T] + func (m AndMatcher[T]) And(matchers ...Matcher[T]) ChainableMatcher[T] + func (m AndMatcher[T]) Matches(i T) (ret bool, err error) + func (m AndMatcher[T]) MatchesWithContext(c context.Context, i T) (ret bool, err error) + func (m AndMatcher[T]) Or(matchers ...Matcher[T]) ChainableMatcher[T] + func (m AndMatcher[T]) String() string + type Base64Value struct + func (v *Base64Value) Set(s string) error + func (v Base64Value) String() string + func (v Base64Value) Type() string + type ChainableMatcher interface + And func(matcher ...Matcher[T]) ChainableMatcher[T] + Or func(matcher ...Matcher[T]) ChainableMatcher[T] + func And[T any](left Matcher[T], right ...Matcher[T]) ChainableMatcher[T] + func Any[T any]() ChainableMatcher[T] + func None[T any]() ChainableMatcher[T] + func Not[T any](matcher Matcher[T]) ChainableMatcher[T] + func Or[T any](left Matcher[T], right ...Matcher[T]) ChainableMatcher[T] + type GenericMatcher struct + Description string + MatchFunc func(context.Context, T) (bool, error) + func (m *GenericMatcher[T]) And(matchers ...Matcher[T]) ChainableMatcher[T] + func (m *GenericMatcher[T]) Matches(i T) (bool, error) + func (m *GenericMatcher[T]) MatchesWithContext(c context.Context, i T) (ret bool, err error) + func (m *GenericMatcher[T]) Or(matchers ...Matcher[T]) ChainableMatcher[T] + func (m *GenericMatcher[T]) String() string + type GitFileMatcher func(path string) bool + func GitFilePattern(patterns ...string) GitFileMatcher + type GitUtils struct + func NewGitUtilsWithPath(path string) (*GitUtils, error) + func NewGitUtilsWithWorkingDir() (*GitUtils, error) + func (g *GitUtils) CommitIfModified(msg string, matchers ...GitFileMatcher) (plumbing.Hash, error) + func (g *GitUtils) HeadCommitHash() (plumbing.Hash, error) + func (g *GitUtils) MarkCommit(tag string, commitHash plumbing.Hash) error + func (g *GitUtils) MarkWorktree(tag string, msg string, detach bool, matchers ...GitFileMatcher) error + func (g *GitUtils) MarkedCommit(tag string) (plumbing.Hash, error) + func (g *GitUtils) Repository() *git.Repository + func (g *GitUtils) ResetToCommit(commitHash plumbing.Hash, discardChanges bool) error + func (g *GitUtils) ResetToMarkedCommit(markedTag string, discardChanges bool) error + func (g *GitUtils) TagCommit(tag string, commitHash plumbing.Hash, opts *git.CreateTagOptions, ...) error + func (g *GitUtils) TagMarkedCommit(markedTag string, newTag string, opts *git.CreateTagOptions) error + func (g *GitUtils) WithContext(ctx context.Context) *GitUtils + type Global struct + OutputDir string + TmpDir string + Verbose bool + WorkingDir string + func (g Global) AbsPath(base, path string) string + type GoCmdOptions func(goCmd *string) + func GoCmdModFile(modFile string) GoCmdOptions + type GoMod struct + Exclude []Module + Go string + Module Module + Replace []Replace + Require []Require + Retract []Retract + func GetGoMod(ctx context.Context, opts ...GoCmdOptions) (*GoMod, error) + type GoModule struct + Dir string + Error *GoModuleError + GoMod string + GoVersion string + Indirect bool + Main bool + Path string + Replace *GoModule + Retracted string + Time *time.Time + Update *GoModule + Version string + Versions []string + func FindModule(ctx context.Context, opts []GoCmdOptions, modules ...string) ([]*GoModule, error) + func ResolveTargetModule(ctx context.Context) *GoModule + type GoModuleError struct + Err string + type GoPackage struct + BinaryOnly bool + BuildID string + CFiles []string + CXXFiles []string + CgoCFLAGS []string + CgoCPPFLAGS []string + CgoCXXFLAGS []string + CgoFFLAGS []string + CgoFiles []string + CgoLDFLAGS []string + CgoPkgConfig []string + CompiledGoFiles []string + ConflictDir string + DepOnly bool + Deps []string + DepsErrors []*GoPackageError + Dir string + Doc string + EmbedFiles []string + EmbedPatterns []string + Error *GoPackageError + Export string + FFiles []string + ForTest string + GoFiles []string + Goroot bool + HFiles []string + IgnoredGoFiles []string + IgnoredOtherFiles []string + ImportComment string + ImportMap map[string]string + ImportPath string + Imports []string + Incomplete bool + MFiles []string + Match []string + Module *GoModule + Name string + Root string + SFiles []string + Shlib string + Stale bool + StaleReason string + Standard bool + SwigCXXFiles []string + SwigFiles []string + SysoFiles []string + Target string + TestEmbedFiles []string + TestEmbedPatterns []string + TestGoFiles []string + TestImports []string + XTestEmbedFiles []string + XTestEmbedPatterns []string + XTestGoFiles []string + XTestImports []string + type GoPackageError struct + Err string + ImportStack []string + Pos string + type Matcher interface + Matches func(T) (bool, error) + MatchesWithContext func(context.Context, T) (bool, error) + type Module struct + Path string + Version string + type NegateMatcher struct + func (m NegateMatcher[T]) And(matchers ...Matcher[T]) ChainableMatcher[T] + func (m NegateMatcher[T]) Matches(i T) (ret bool, err error) + func (m NegateMatcher[T]) MatchesWithContext(c context.Context, i T) (ret bool, err error) + func (m NegateMatcher[T]) Or(matchers ...Matcher[T]) ChainableMatcher[T] + func (m NegateMatcher[T]) String() string + type NoopMatcher bool + func (m NoopMatcher[T]) And(matchers ...Matcher[T]) ChainableMatcher[T] + func (m NoopMatcher[T]) Matches(_ T) (bool, error) + func (m NoopMatcher[T]) MatchesWithContext(context.Context, T) (bool, error) + func (m NoopMatcher[T]) Or(matchers ...Matcher[T]) ChainableMatcher[T] + func (m NoopMatcher[T]) String() string + type OrMatcher []Matcher[T] + func (m OrMatcher[T]) And(matchers ...Matcher[T]) ChainableMatcher[T] + func (m OrMatcher[T]) Matches(i T) (ret bool, err error) + func (m OrMatcher[T]) MatchesWithContext(c context.Context, i T) (ret bool, err error) + func (m OrMatcher[T]) Or(matchers ...Matcher[T]) ChainableMatcher[T] + func (m OrMatcher[T]) String() string + type Replace struct + New Module + Old Module + func DropInvalidReplace(ctx context.Context, opts ...GoCmdOptions) (ret []*Replace, err error) + type Require struct + Indirect bool + Path string + Version string + type Retract struct + High string + Low string + Rationale string + type RunE func(cmd *cobra.Command, args []string) error + func EnsureDir(dirPath *string, base string, cleanIfExist bool, desc string) RunE + func EnsureGlobalDirectories() RunE + func MergeRunE(funcs ...RunE) RunE + func PrintEnvironment() RunE + type ShCmdOption struct + Cmds []string + Dir string + Env []string + ShowCmd bool + Stderr io.Writer + Stdin io.Reader + Stdout io.Writer + type ShCmdOptions func(opt *ShCmdOption) + func ShellCmd(cmds ...string) ShCmdOptions + func ShellDir(dir string) ShCmdOptions + func ShellEnv(env ...string) ShCmdOptions + func ShellShowCmd(show bool) ShCmdOptions + func ShellStdErr(w io.Writer) ShCmdOptions + func ShellStdIn(r io.Reader) ShCmdOptions + func ShellStdOut(w io.Writer) ShCmdOptions + func ShellUseOutputDir() ShCmdOptions + func ShellUseTmpDir() ShCmdOptions + func ShellUseWorkingDir() ShCmdOptions + type StringMatcher interface + func AnyNonEmptyString() StringMatcher + func WithPathPattern(pattern string) StringMatcher + func WithPrefix(prefix string, caseInsensitive bool) StringMatcher + func WithRegex(regex string) StringMatcher + func WithRegexPattern(regex *regexp.Regexp) StringMatcher + func WithString(expected string, caseInsensitive bool) StringMatcher + func WithSubString(substr string, caseInsensitive bool) StringMatcher + func WithSuffix(suffix string, caseInsensitive bool) StringMatcher + type TemplateOption struct + CommonTmpl string + Customizer func(*template.Template) + FS embed.FS + Model interface{} + Output string + OutputPerm os.FileMode + Overwrite bool + TmplName string