Documentation ¶
Overview ¶
Package gtz provides various utilities for running Go commands and Go-based CLI tools.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( GoToolGoCov = NewGoTool("github.com/axw/gocov", "gocov", "v1.2.1") GoToolGoCovHTML = NewGoTool("github.com/matm/gocov-html", "cmd/gocov-html", "v1.4.0") GoToolGolint = NewGoTool("golang.org/x/lint", "golint", "v0.0.0-20210508222113-6edffad5e616") GoToolMockGen = NewGoTool("go.uber.org/mock", "/mockgen", "v0.5.0") GoToolPkgsite = NewGoTool("golang.org/x/pkgsite", "cmd/pkgsite", "latest") GoToolSQLC = NewGoTool("github.com/sqlc-dev/sqlc", "cmd/sqlc", "v1.27.0") GoToolSQLCGenGo = NewGoTool("github.com/sqlc-dev/sqlc-gen-go", "", "v1.4.0") GoToolStaticCheck = NewGoTool("honnef.co/go/tools", "cmd/staticcheck", "2024.1.1") )
Known Go tools.
Functions ¶
func MustGenerateLongVersion ¶ added in v0.5.0
func MustGenerateLongVersion() string
MustGenerateLongVersion generates a version using the current time and git commit hash.
func MustGenerateShortVersion ¶ added in v0.5.0
func MustGenerateShortVersion() string
MustGenerateShortVersion generates a version using the current git commit hash.
func MustRunGoChecks ¶
func MustRunGoChecks(params *GoChecksParams)
MustRunGoChecks runs a set of Go checks in the current working directory.
func MustRunGoTests ¶
func MustRunGoTests(params *GoTestsParams)
MustRunGoTests runs a set of Go tests in the current working directory.
Types ¶
type GoChecksParams ¶
GoChecksParams describes the parameters for running Go checks.
type GoTestsParams ¶
type GoTestsParams struct { AllPackages []string SelectedPackages []string BuildTags []string TestRegexp string IgnoreCache bool Verbose *bool CoverageDirPath string OpenCoverage bool }
GoTestsParams describes the parameters for running Go tests.
type GoTool ¶
type GoTool struct {
// contains filtered or unexported fields
}
GoTool describes a Go tool.
func (*GoTool) GetArgument ¶
GetArgument returns an argument string suitable for Go run.
func (*GoTool) GetCommand ¶
GetCommand returns a *shellz.Command for this Go tool.
func (*GoTool) GetPackage ¶
GetPackage returns the Go tool package.
func (*GoTool) GetVersion ¶
GetVersion returns the current Go tool defaultVersion (either pinned, or from go.mod).