Dagger
Search

gotest

No long description provided.

Installation

dagger install github.com/Excoriate/daggerverse/gotest@v1.15.3

Entrypoint

Return Type
Gotest !
Arguments
NameTypeDescription
versionString version is the version of the GoReleaser to use, e.g., "v1.22.0".
imageString image is the image to use as the base container.
ctrContainer Ctrl is the container to use as a base container.
envVarsFromHostString EnvVarsFromHost is a list of environment variables to pass from the host to the container. Later on, in order to pass it to the container, it's going to be converted into a map.
Example
func (m *myModule) example() *Gotest  {
	return dag.
			Gotest()
}
@function
def example() -> dag.Gotest:
	return (
		dag.gotest()
	)
@func()
example(): Gotest {
	return dag
		.gotest()
}

Types

Gotest 🔗

src() 🔗

Src is the directory that contains all the source code, including the module directory.

Return Type
Directory !
Example
dagger -m github.com/Excoriate/daggerverse/gotest@cad63139ee2105a70f49e8ae46e973a6d6c1a80f call \
 src
func (m *myModule) example() *Directory  {
	return dag.
			Gotest().
			Src()
}
@function
def example() -> dagger.Directory:
	return (
		dag.gotest()
		.src()
	)
@func()
example(): Directory {
	return dag
		.gotest()
		.src()
}

ctr() 🔗

Ctr is the container to use as a base container.

Return Type
Container !
Example
dagger -m github.com/Excoriate/daggerverse/gotest@cad63139ee2105a70f49e8ae46e973a6d6c1a80f call \
 ctr
func (m *myModule) example() *Container  {
	return dag.
			Gotest().
			Ctr()
}
@function
def example() -> dagger.Container:
	return (
		dag.gotest()
		.ctr()
	)
@func()
example(): Container {
	return dag
		.gotest()
		.ctr()
}

base() 🔗

Base sets the base image and version, and creates the base container. The default image is “golang/alpine” and the default version is “latest”.

Return Type
Gotest !
Arguments
NameTypeDefault ValueDescription
imageUrlString !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/gotest@cad63139ee2105a70f49e8ae46e973a6d6c1a80f call \
 base --image-url string \
 run-go-test --src DIR_PATH
func (m *myModule) example(imageUrl string) *Gotest  {
	return dag.
			Gotest().
			Base(imageUrl)
}
@function
def example(image_url: str) -> dag.Gotest:
	return (
		dag.gotest()
		.base(image_url)
	)
@func()
example(imageUrl: string): Gotest {
	return dag
		.gotest()
		.base(imageUrl)
}

runGoTest() 🔗

RunGoTest runs tests using the go test CLI. The default packages to test are “./…”.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
srcDirectory !-The directory containing code to test.
packages[String ! ] -Packages to test.
enableVerboseBoolean -enableVerbose is a flag to run tests with -v.
raceBoolean -race is a flag to run tests with
testFlags[String ! ] -Arbitrary flags to pass along to go test.
insecureRootCapabilitiesBoolean -Whether to run tests insecurely, i.e. with special privileges.
nestBoolean -Enable experimental Dagger nesting.
enableCacheBoolean -enableCache is a flag to enable cache volumes.
envVars[String ! ] -envVars is a list of environment variables to set in the container with the format "SOMETHING=SOMETHING,SOMETHING=SOMETHING".
printEnvVarsBoolean -printEnvVars is a flag to print the environment variables
Example
dagger -m github.com/Excoriate/daggerverse/gotest@cad63139ee2105a70f49e8ae46e973a6d6c1a80f call \
 run-go-test --src DIR_PATH
func (m *myModule) example(ctx context.Context, src *Directory) string  {
	return dag.
			Gotest().
			RunGoTest(ctx, src)
}
@function
async def example(src: dagger.Directory) -> str:
	return await (
		dag.gotest()
		.run_go_test(src)
	)
@func()
async example(src: Directory): Promise<string> {
	return dag
		.gotest()
		.runGoTest(src)
}

runGoTestSum() 🔗

RunGoTestSum runs tests using the gotestsum CLI.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
srcDirectory !-The directory containing code to test.
packages[String ! ] -Packages to test.
raceBoolean -race is a flag to run tests with
testFlags[String ! ] -Arbitrary flags to pass along to go test.
goTestSumFlags[String ! ] -goTestSumFlags is a flag to pass along to go test -json.
formatString -format defines the option for the GoTestsum format to display
insecureRootCapabilitiesBoolean -Whether to run tests insecurely, i.e. with special privileges.
enableNestBoolean -Enable experimental Dagger nesting. It sets the ExperimentalPrivilegedNesting option in Dagger.
enableCacheBoolean -enableCache is a flag to enable cache volumes. If it's set, it'll enable the cache volumes for the Go module and build cache.
enablePrettyBoolean -enablePretty is a flag to enable pretty output.
envVars[String ! ] -envVars is a list of environment variables to set in the container with the format "SOMETHING=SOMETHING,SOMETHING=SOMETHING".
printEnvVarsBoolean -printEnvVars is a flag to print the environment variables
Example
dagger -m github.com/Excoriate/daggerverse/gotest@cad63139ee2105a70f49e8ae46e973a6d6c1a80f call \
 run-go-test-sum --src DIR_PATH
func (m *myModule) example(ctx context.Context, src *Directory) string  {
	return dag.
			Gotest().
			RunGoTestSum(ctx, src)
}
@function
async def example(src: dagger.Directory) -> str:
	return await (
		dag.gotest()
		.run_go_test_sum(src)
	)
@func()
async example(src: Directory): Promise<string> {
	return dag
		.gotest()
		.runGoTestSum(src)
}

withSource() 🔗

WithSource Set the source directory.

Return Type
Gotest !
Arguments
NameTypeDefault ValueDescription
srcDirectory !-Src is the directory that contains all the source code, including the module directory.
workdirString -workdir is the working directory.
Example
dagger -m github.com/Excoriate/daggerverse/gotest@cad63139ee2105a70f49e8ae46e973a6d6c1a80f call \
 with-source --src DIR_PATH \
 run-go-test --src DIR_PATH
func (m *myModule) example(src *Directory) *Gotest  {
	return dag.
			Gotest().
			WithSource(src)
}
@function
def example(src: dagger.Directory) -> dag.Gotest:
	return (
		dag.gotest()
		.with_source(src)
	)
@func()
example(src: Directory): Gotest {
	return dag
		.gotest()
		.withSource(src)
}

withPlatform() 🔗

WithPlatform Set GOOS, GOARCH and GOARM environment variables.

Return Type
Gotest !
Arguments
NameTypeDefault ValueDescription
platformScalar !-Target platform in "[os]/[platform]/[version]" format (e.g., "darwin/arm64/v7", "windows/amd64", "linux/arm64").
Example
dagger -m github.com/Excoriate/daggerverse/gotest@cad63139ee2105a70f49e8ae46e973a6d6c1a80f call \
 with-platform \
 run-go-test --src DIR_PATH
func (m *myModule) example(platform ) *Gotest  {
	return dag.
			Gotest().
			WithPlatform(platform)
}
@function
def example(platform: ) -> dag.Gotest:
	return (
		dag.gotest()
		.with_platform(platform)
	)
@func()
example(platform: ): Gotest {
	return dag
		.gotest()
		.withPlatform(platform)
}

withCgoEnabled() 🔗

WithCgoEnabled Set CGO_ENABLED environment variable to 1.

Return Type
Gotest !
Example
dagger -m github.com/Excoriate/daggerverse/gotest@cad63139ee2105a70f49e8ae46e973a6d6c1a80f call \
 with-cgo-enabled \
 run-go-test --src DIR_PATH
func (m *myModule) example() *Gotest  {
	return dag.
			Gotest().
			WithCgoEnabled()
}
@function
def example() -> dag.Gotest:
	return (
		dag.gotest()
		.with_cgo_enabled()
	)
@func()
example(): Gotest {
	return dag
		.gotest()
		.withCgoEnabled()
}

withCgoDisabled() 🔗

WithCgoDisabled Set CGO_ENABLED environment variable to 0.

Return Type
Gotest !
Example
dagger -m github.com/Excoriate/daggerverse/gotest@cad63139ee2105a70f49e8ae46e973a6d6c1a80f call \
 with-cgo-disabled \
 run-go-test --src DIR_PATH
func (m *myModule) example() *Gotest  {
	return dag.
			Gotest().
			WithCgoDisabled()
}
@function
def example() -> dag.Gotest:
	return (
		dag.gotest()
		.with_cgo_disabled()
	)
@func()
example(): Gotest {
	return dag
		.gotest()
		.withCgoDisabled()
}

withEnvVar() 🔗

WithEnvVar Set an environment variable.

Return Type
Gotest !
Arguments
NameTypeDefault ValueDescription
nameString !-The name of the environment variable (e.g., "HOST").
valueString !-The value of the environment variable (e.g., "localhost").
expandBoolean -Replace `${VAR}` or $VAR in the value according to the current environment variables defined in the container (e.g., "/opt/bin:$PATH").
Example
dagger -m github.com/Excoriate/daggerverse/gotest@cad63139ee2105a70f49e8ae46e973a6d6c1a80f call \
 with-env-var --name string --value string \
 run-go-test --src DIR_PATH
func (m *myModule) example(name string, value string) *Gotest  {
	return dag.
			Gotest().
			WithEnvVar(name, value)
}
@function
def example(name: str, value: str) -> dag.Gotest:
	return (
		dag.gotest()
		.with_env_var(name, value)
	)
@func()
example(name: string, value: string): Gotest {
	return dag
		.gotest()
		.withEnvVar(name, value)
}

withModuleCache() 🔗

WithModuleCache sets the module cache for the Go module. The default cache volume is “godmodcache”, and the default mount path is “/go/pkg/mod”.

Return Type
Gotest !
Example
dagger -m github.com/Excoriate/daggerverse/gotest@cad63139ee2105a70f49e8ae46e973a6d6c1a80f call \
 with-module-cache \
 run-go-test --src DIR_PATH
func (m *myModule) example() *Gotest  {
	return dag.
			Gotest().
			WithModuleCache()
}
@function
def example() -> dag.Gotest:
	return (
		dag.gotest()
		.with_module_cache()
	)
@func()
example(): Gotest {
	return dag
		.gotest()
		.withModuleCache()
}

withBuildCache() 🔗

WithBuildCache sets the build cache for the Go module. The default cache volume is “gobuildcache”, and the default mount path is “/go/build-cache”.

Return Type
Gotest !
Example
dagger -m github.com/Excoriate/daggerverse/gotest@cad63139ee2105a70f49e8ae46e973a6d6c1a80f call \
 with-build-cache \
 run-go-test --src DIR_PATH
func (m *myModule) example() *Gotest  {
	return dag.
			Gotest().
			WithBuildCache()
}
@function
def example() -> dag.Gotest:
	return (
		dag.gotest()
		.with_build_cache()
	)
@func()
example(): Gotest {
	return dag
		.gotest()
		.withBuildCache()
}

withGoCache() 🔗

WithGoCache mounts the Go cache directories.

Return Type
Gotest !
Example
dagger -m github.com/Excoriate/daggerverse/gotest@cad63139ee2105a70f49e8ae46e973a6d6c1a80f call \
 with-go-cache \
 run-go-test --src DIR_PATH
func (m *myModule) example() *Gotest  {
	return dag.
			Gotest().
			WithGoCache()
}
@function
def example() -> dag.Gotest:
	return (
		dag.gotest()
		.with_go_cache()
	)
@func()
example(): Gotest {
	return dag
		.gotest()
		.withGoCache()
}

withNewNetrcFileGitHub() 🔗

WithNewNetrcFileGitHub creates a new .netrc file with the GitHub credentials.

The .netrc file is created in the root directory of the container.

Return Type
Gotest !
Arguments
NameTypeDefault ValueDescription
usernameString !-No description provided
passwordString !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/gotest@cad63139ee2105a70f49e8ae46e973a6d6c1a80f call \
 with-new-netrc-file-git-hub --username string --password string \
 run-go-test --src DIR_PATH
func (m *myModule) example(username string, password string) *Gotest  {
	return dag.
			Gotest().
			WithNewNetrcFileGitHub(username, password)
}
@function
def example(username: str, password: str) -> dag.Gotest:
	return (
		dag.gotest()
		.with_new_netrc_file_git_hub(username, password)
	)
@func()
example(username: string, password: string): Gotest {
	return dag
		.gotest()
		.withNewNetrcFileGitHub(username, password)
}

withNewNetrcFileGitLab() 🔗

WithNewNetrcFileGitLab creates a new .netrc file with the GitLab credentials.

The .netrc file is created in the root directory of the container.

Return Type
Gotest !
Arguments
NameTypeDefault ValueDescription
usernameString !-No description provided
passwordString !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/gotest@cad63139ee2105a70f49e8ae46e973a6d6c1a80f call \
 with-new-netrc-file-git-lab --username string --password string \
 run-go-test --src DIR_PATH
func (m *myModule) example(username string, password string) *Gotest  {
	return dag.
			Gotest().
			WithNewNetrcFileGitLab(username, password)
}
@function
def example(username: str, password: str) -> dag.Gotest:
	return (
		dag.gotest()
		.with_new_netrc_file_git_lab(username, password)
	)
@func()
example(username: string, password: string): Gotest {
	return dag
		.gotest()
		.withNewNetrcFileGitLab(username, password)
}

withPrivateGoPkg() 🔗

WithPrivateGoPkg sets the GOPRIVATE environment variable.

The GOPRIVATE environment variable is used to specify a comma-separated list of hosts for which Go modules should always be fetched directly from VCS repositories.

Return Type
Gotest !
Arguments
NameTypeDefault ValueDescription
privateHostString !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/gotest@cad63139ee2105a70f49e8ae46e973a6d6c1a80f call \
 with-private-go-pkg --private-host string \
 run-go-test --src DIR_PATH
func (m *myModule) example(privateHost string) *Gotest  {
	return dag.
			Gotest().
			WithPrivateGoPkg(privateHost)
}
@function
def example(private_host: str) -> dag.Gotest:
	return (
		dag.gotest()
		.with_private_go_pkg(private_host)
	)
@func()
example(privateHost: string): Gotest {
	return dag
		.gotest()
		.withPrivateGoPkg(privateHost)
}

setupGoTest() 🔗

SetupGoTest sets up the go test options, to either evaluate the container and run the test, or return the container to be evaluated later.

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
srcDirectory !-The directory containing code to test.
packages[String ! ] -Packages to test.
enableVerboseBoolean -enableVerbose is a flag to run tests with -v.
raceBoolean -race is a flag to run tests with
testFlags[String ! ] -Arbitrary flags to pass along to go test.
insecureRootCapabilitiesBoolean -Whether to run tests insecurely, i.e. with special privileges.
enableNestBoolean -Enable experimental Dagger nesting. It sets the ExperimentalPrivilegedNesting option in Dagger.
enableCacheBoolean -enableCache is a flag to enable cache volumes. If it's set, it'll enable the cache volumes for the Go module and build cache.
envVars[String ! ] -envVars is a list of environment variables to set in the container with the format "SOMETHING=SOMETHING,SOMETHING=SOMETHING".
printEnvVarsBoolean -printEnvVars is a flag to print the environment variables
Example
dagger -m github.com/Excoriate/daggerverse/gotest@cad63139ee2105a70f49e8ae46e973a6d6c1a80f call \
 setup-go-test --src DIR_PATH
func (m *myModule) example(src *Directory) *Container  {
	return dag.
			Gotest().
			SetupGoTest(src)
}
@function
def example(src: dagger.Directory) -> dagger.Container:
	return (
		dag.gotest()
		.setup_go_test(src)
	)
@func()
example(src: Directory): Container {
	return dag
		.gotest()
		.setupGoTest(src)
}

setupGoTestSum() 🔗

SetupGoTestSum sets up the go test options, to either evaluate the container and run the test, or return the container to be evaluated later.

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
srcDirectory !-The directory containing code to test.
packages[String ! ] -Packages to test.
raceBoolean -race is a flag to run tests with
testFlags[String ! ] -Arbitrary flags to pass along to go test.
goTestSumFlags[String ! ] -goTestSumFlags is a flag to pass along to go test -json.
formatString -format defines the option for the GoTestsum format to display
insecureRootCapabilitiesBoolean -Whether to run tests insecurely, i.e. with special privileges.
enableNestBoolean -Enable experimental Dagger nesting. It sets the ExperimentalPrivilegedNesting option in Dagger.
enableCacheBoolean -enableCache is a flag to enable cache volumes. If it's set, it'll enable the cache volumes for the Go module and build cache.
enablePrettyBoolean -enablePretty is a flag to enable pretty output.
envVars[String ! ] -envVars is a list of environment variables to set in the container with the format "SOMETHING=SOMETHING,SOMETHING=SOMETHING".
printEnvVarsBoolean -printEnvVars is a flag to print the environment variables
Example
dagger -m github.com/Excoriate/daggerverse/gotest@cad63139ee2105a70f49e8ae46e973a6d6c1a80f call \
 setup-go-test-sum --src DIR_PATH
func (m *myModule) example(src *Directory) *Container  {
	return dag.
			Gotest().
			SetupGoTestSum(src)
}
@function
def example(src: dagger.Directory) -> dagger.Container:
	return (
		dag.gotest()
		.setup_go_test_sum(src)
	)
@func()
example(src: Directory): Container {
	return dag
		.gotest()
		.setupGoTestSum(src)
}