gtz

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package gtz provides various utilities for running Go commands and Go-based CLI tools.

Index

Constants

This section is empty.

Variables

View Source
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

type GoChecksParams struct {
	AllPackages []string
	BuildTags   []string
}

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 NewGoTool

func NewGoTool(pkg, path, defaultVersion string) *GoTool

NewGoTool initializes a new *GoTool.

func (*GoTool) GetArgument

func (t *GoTool) GetArgument() string

GetArgument returns an argument string suitable for Go run.

func (*GoTool) GetCommand

func (t *GoTool) GetCommand() *shellz.Command

GetCommand returns a *shellz.Command for this Go tool.

func (*GoTool) GetPackage

func (t *GoTool) GetPackage() string

GetPackage returns the Go tool package.

func (*GoTool) GetVersion

func (t *GoTool) GetVersion() string

GetVersion returns the current Go tool defaultVersion (either pinned, or from go.mod).

func (*GoTool) MustRun

func (t *GoTool) MustRun(params ...string)

MustRun runs the Go tool.

Jump to

Keyboard shortcuts

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