devz

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

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")
	GoToolStaticCheck = NewGoTool("honnef.co/go/tools", "cmd/staticcheck", "2024.1.1")
)

Known Go tools.

View Source
var (
	// DefaultRuntimeGOOS allows to inject different values of "runtime.GOOS" for tests.
	DefaultRuntimeGOOS = runtime.GOOS
)

Functions

func MustDownloadFile added in v0.5.0

func MustDownloadFile(url, outFilePath string)

MustDownloadFile downloads a file.

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.

func NewDockerComposeConfigDeploy

func NewDockerComposeConfigDeploy(memoryLimitMB int64, replicas uint64) *ct.DeployConfig

NewDockerComposeConfigDeploy is a Docker Compose config helper.

func NewDockerComposeConfigExtraHosts

func NewDockerComposeConfigExtraHosts(extraHostsMaps ...map[string]string) ct.HostsList

NewDockerComposeConfigExtraHosts is a Docker Compose config helper.

func NewDockerComposeConfigHealthCheckShell

func NewDockerComposeConfigHealthCheckShell(format string, a ...any) *ct.HealthCheckConfig

NewDockerComposeConfigHealthCheckShell is a Docker Compose config helper.

func RestoreDefaultRuntimeGOOS

func RestoreDefaultRuntimeGOOS()

RestoreDefaultRuntimeGOOS restores the default value of DefaultRuntimeGOOS.

Types

type DockerCompose

type DockerCompose struct {
	// contains filtered or unexported fields
}

DockerCompose helps operate a Docker Compose config.

func NewDockerCompose

func NewDockerCompose(cfg *ct.Config) *DockerCompose

NewDockerCompose initializes a new Docker Compose.

func (*DockerCompose) GetCommand

func (d *DockerCompose) GetCommand() *shellz.Command

GetCommand returns a pre-configured "docker compose" command.

func (*DockerCompose) GetConfig

func (d *DockerCompose) GetConfig() *ct.Config

GetConfig returns the Docker Compose config.

func (*DockerCompose) GetDownCommand

func (d *DockerCompose) GetDownCommand() *shellz.Command

GetDownCommand returns a pre-configured "docker compose down" command.

func (*DockerCompose) GetMarshaledConfig

func (d *DockerCompose) GetMarshaledConfig() []byte

GetMarshaledConfig returns the Docker Compose config marshaled to YAML.

func (*DockerCompose) GetPSCommand

func (d *DockerCompose) GetPSCommand() *shellz.Command

GetPSCommand returns a pre-configured "docker compose ps" command.

func (*DockerCompose) GetProfiles

func (d *DockerCompose) GetProfiles() []string

GetProfiles returns the Docker Compose profiles if set.

func (*DockerCompose) GetProjectName

func (d *DockerCompose) GetProjectName() string

GetProjectName returns the Docker Compose project name if set.

func (*DockerCompose) GetUpCommand

func (d *DockerCompose) GetUpCommand() *shellz.Command

GetUpCommand returns a pre-configured "docker compose up" command.

func (*DockerCompose) WithProfiles

func (d *DockerCompose) WithProfiles(profiles ...string) *DockerCompose

WithProfiles returns a clone of the Docker Compose with the given profiles set.

func (*DockerCompose) WithProjectName

func (d *DockerCompose) WithProjectName(projectName string) *DockerCompose

WithProjectName returns a clone of the Docker Compose with the given project name set.

type DownloadError added in v0.5.0

type DownloadError struct {
	// contains filtered or unexported fields
}

DownloadError describes a download error.

func NewDownloadError added in v0.5.0

func NewDownloadError(url string, statusCode int, message string) *DownloadError

NewDownloadError initializes a new download error.

func (*DownloadError) Error added in v0.5.0

func (e *DownloadError) Error() string

Error implements the error interface.

func (*DownloadError) GetStatusCode added in v0.5.0

func (e *DownloadError) GetStatusCode() int

GetStatusCode returns the status code.

func (*DownloadError) GetURL added in v0.5.0

func (e *DownloadError) GetURL() string

GetURL returns the URL.

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 MustLookupGoTool

func MustLookupGoTool(key string) *GoTool

MustLookupGoTool returns a *GoTool

func NewGoTool

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

NewGoTool initializes a new Go tool.

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 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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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