Dagger
Search

gotest

No long description provided.

Installation

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

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
dagger -m github.com/Excoriate/daggerverse/gotest@4855469fd37d6cb07c216cfee2e301053bb80722 call \
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@4855469fd37d6cb07c216cfee2e301053bb80722 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@4855469fd37d6cb07c216cfee2e301053bb80722 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
imageString !-No description provided
versionString !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/gotest@4855469fd37d6cb07c216cfee2e301053bb80722 call \
 base --image string --version string
func (m *myModule) example(image string, version string) *Gotest  {
	return dag.
			Gotest().
			Base(image, version)
}
@function
def example(image: str, version: str) -> dag.Gotest:
	return (
		dag.gotest()
		.base(image, version)
	)
@func()
example(image: string, version: string): Gotest {
	return dag
		.gotest()
		.base(image, version)
}

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@4855469fd37d6cb07c216cfee2e301053bb80722 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@4855469fd37d6cb07c216cfee2e301053bb80722 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@4855469fd37d6cb07c216cfee2e301053bb80722 call \
 with-source --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@4855469fd37d6cb07c216cfee2e301053bb80722 call \
 with-platform
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@4855469fd37d6cb07c216cfee2e301053bb80722 call \
 with-cgo-enabled
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@4855469fd37d6cb07c216cfee2e301053bb80722 call \
 with-cgo-disabled
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()
}

withEnvVariable() 🔗

WithEnvVariable 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@4855469fd37d6cb07c216cfee2e301053bb80722 call \
 with-env-variable --name string --value string
func (m *myModule) example(name string, value string) *Gotest  {
	return dag.
			Gotest().
			WithEnvVariable(name, value)
}
@function
def example(name: str, value: str) -> dag.Gotest:
	return (
		dag.gotest()
		.with_env_variable(name, value)
	)
@func()
example(name: string, value: string): Gotest {
	return dag
		.gotest()
		.withEnvVariable(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
Container !
Arguments
NameTypeDefault ValueDescription
ctrContainer !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/gotest@4855469fd37d6cb07c216cfee2e301053bb80722 call \
 with-module-cache --ctr IMAGE:TAG
func (m *myModule) example(ctr *Container) *Container  {
	return dag.
			Gotest().
			WithModuleCache(ctr)
}
@function
def example(ctr: dagger.Container) -> dagger.Container:
	return (
		dag.gotest()
		.with_module_cache(ctr)
	)
@func()
example(ctr: Container): Container {
	return dag
		.gotest()
		.withModuleCache(ctr)
}

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
Container !
Arguments
NameTypeDefault ValueDescription
ctrContainer !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/gotest@4855469fd37d6cb07c216cfee2e301053bb80722 call \
 with-build-cache --ctr IMAGE:TAG
func (m *myModule) example(ctr *Container) *Container  {
	return dag.
			Gotest().
			WithBuildCache(ctr)
}
@function
def example(ctr: dagger.Container) -> dagger.Container:
	return (
		dag.gotest()
		.with_build_cache(ctr)
	)
@func()
example(ctr: Container): Container {
	return dag
		.gotest()
		.withBuildCache(ctr)
}

withGoCache() 🔗

WithGoCache mounts the Go cache directories.

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
ctrContainer !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/gotest@4855469fd37d6cb07c216cfee2e301053bb80722 call \
 with-go-cache --ctr IMAGE:TAG
func (m *myModule) example(ctr *Container) *Container  {
	return dag.
			Gotest().
			WithGoCache(ctr)
}
@function
def example(ctr: dagger.Container) -> dagger.Container:
	return (
		dag.gotest()
		.with_go_cache(ctr)
	)
@func()
example(ctr: Container): Container {
	return dag
		.gotest()
		.withGoCache(ctr)
}

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@4855469fd37d6cb07c216cfee2e301053bb80722 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@4855469fd37d6cb07c216cfee2e301053bb80722 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)
}