gotest
No long description provided.
Installation
dagger install github.com/Excoriate/daggerverse/gotest@v1.17.0Entrypoint
Return Type
Gotest !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| version | String | - | version is the version of the GoReleaser to use, e.g., "v1.22.0". |
| image | String | - | image is the image to use as the base container. |
| ctr | Container | - | Ctrl is the container to use as a base container. |
| envVarsFromHost | String | - | 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@ad19fa76c14b01850c15fbc471b1ae183154a341 call \
func (m *MyModule) Example() *dagger.Gotest {
return dag.
Gotest()
}@function
def example() -> dagger.Gotest:
return (
dag.gotest()
)@func()
example(): Gotest {
return dag
.gotest()
}Types
Gotest 🔗
Gotest is a module that provides functionality to run Go tests.
The module can be used to run tests in a Go project.
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@ad19fa76c14b01850c15fbc471b1ae183154a341 call \
srcfunc (m *MyModule) Example() *dagger.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@ad19fa76c14b01850c15fbc471b1ae183154a341 call \
ctrfunc (m *MyModule) Example() *dagger.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
| Name | Type | Default Value | Description |
|---|---|---|---|
| imageUrl | String ! | - | No description provided |
Example
dagger -m github.com/Excoriate/daggerverse/gotest@ad19fa76c14b01850c15fbc471b1ae183154a341 call \
base --image-url stringfunc (m *MyModule) Example(imageUrl string) *dagger.Gotest {
return dag.
Gotest().
Base(imageUrl)
}@function
def example(imageurl: str) -> dagger.Gotest:
return (
dag.gotest()
.base(imageurl)
)@func()
example(imageUrl: string): Gotest {
return dag
.gotest()
.base(imageUrl)
}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
| Name | Type | Default Value | Description |
|---|---|---|---|
| src | Directory ! | - | The directory containing code to test. |
| packages | [String ! ] | - | Packages to test. |
| enableVerbose | Boolean | - | enableVerbose is a flag to run tests with -v. |
| race | Boolean | - | race is a flag to run tests with |
| testFlags | [String ! ] | - | Arbitrary flags to pass along to go test. |
| insecureRootCapabilities | Boolean | - | Whether to run tests insecurely, i.e. with special privileges. |
| enableNest | Boolean | - | Enable experimental Dagger nesting. It sets the ExperimentalPrivilegedNesting option in Dagger. |
| enableCache | Boolean | - | 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 with the format "SOMETHING=SOMETHING,SOMETHING=SOMETHING". |
| printEnvVars | Boolean | - | printEnvVars is a flag to print the environment variables |
Example
dagger -m github.com/Excoriate/daggerverse/gotest@ad19fa76c14b01850c15fbc471b1ae183154a341 call \
setup-go-test --src DIR_PATHfunc (m *MyModule) Example(src *dagger.Directory) *dagger.Container {
return dag.
Gotest().
Setupgotest(src)
}@function
def example(src: dagger.Directory) -> dagger.Container:
return (
dag.gotest()
.setupgotest(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
| Name | Type | Default Value | Description |
|---|---|---|---|
| src | Directory ! | - | The directory containing code to test. |
| packages | [String ! ] | - | Packages to test. |
| testFlags | [String ! ] | - | Arbitrary flags to pass along to go test. |
| goTestSumFlags | [String ! ] | - | goTestSumFlags is a flag to pass along to go test -json. |
| format | String | - | format defines the option for the GoTestsum format to display |
| insecureRootCapabilities | Boolean | - | Whether to run tests insecurely, i.e. with special privileges. |
| enableNest | Boolean | - | Enable experimental Dagger nesting. It sets the ExperimentalPrivilegedNesting option in Dagger. |
| enableCache | Boolean | - | 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. |
| enablePretty | Boolean | - | enablePretty is a flag to enable pretty output. |
| envVars | [String ! ] | - | envVars is a list of environment variables to set with the format "SOMETHING=SOMETHING,SOMETHING=SOMETHING". |
| printEnvVars | Boolean | - | printEnvVars is a flag to print the environment variables |
Example
dagger -m github.com/Excoriate/daggerverse/gotest@ad19fa76c14b01850c15fbc471b1ae183154a341 call \
setup-go-test-sum --src DIR_PATHfunc (m *MyModule) Example(src *dagger.Directory) *dagger.Container {
return dag.
Gotest().
Setupgotestsum(src)
}@function
def example(src: dagger.Directory) -> dagger.Container:
return (
dag.gotest()
.setupgotestsum(src)
)@func()
example(src: Directory): Container {
return dag
.gotest()
.setupGoTestSum(src)
}withSource() 🔗
WithSource Set the source directory.
Return Type
Gotest !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| src | Directory ! | - | Src is the directory that contains all the source code, including the module directory. |
| workdir | String | - | workdir is the working directory. |
Example
dagger -m github.com/Excoriate/daggerverse/gotest@ad19fa76c14b01850c15fbc471b1ae183154a341 call \
with-source --src DIR_PATHfunc (m *MyModule) Example(src *dagger.Directory) *dagger.Gotest {
return dag.
Gotest().
Withsource(src)
}@function
def example(src: dagger.Directory) -> dagger.Gotest:
return (
dag.gotest()
.withsource(src)
)@func()
example(src: Directory): Gotest {
return dag
.gotest()
.withSource(src)
}withPlatform() 🔗
WithPlatform Set GOOS, GOARCH and GOARM environment variables.
Return Type
Gotest !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| platform | Scalar ! | - | Target platform in "[os]/[platform]/[version]" format (e.g., "darwin/arm64/v7", "windows/amd64", "linux/arm64"). |
Example
dagger -m github.com/Excoriate/daggerverse/gotest@ad19fa76c14b01850c15fbc471b1ae183154a341 call \
with-platformfunc (m *MyModule) Example(platform ) *dagger.Gotest {
return dag.
Gotest().
Withplatform(platform)
}@function
def example(platform: ) -> dagger.Gotest:
return (
dag.gotest()
.withplatform(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@ad19fa76c14b01850c15fbc471b1ae183154a341 call \
with-cgo-enabledfunc (m *MyModule) Example() *dagger.Gotest {
return dag.
Gotest().
Withcgoenabled()
}@function
def example() -> dagger.Gotest:
return (
dag.gotest()
.withcgoenabled()
)@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@ad19fa76c14b01850c15fbc471b1ae183154a341 call \
with-cgo-disabledfunc (m *MyModule) Example() *dagger.Gotest {
return dag.
Gotest().
Withcgodisabled()
}@function
def example() -> dagger.Gotest:
return (
dag.gotest()
.withcgodisabled()
)@func()
example(): Gotest {
return dag
.gotest()
.withCgoDisabled()
}withEnvironmentVariable() 🔗
WithEnvironmentVariable Set an environment variable.
Return Type
Gotest !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| name | String ! | - | The name of the environment variable (e.g., "HOST"). |
| value | String ! | - | The value of the environment variable (e.g., "localhost"). |
| expand | Boolean | - | 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@ad19fa76c14b01850c15fbc471b1ae183154a341 call \
with-environment-variable --name string --value stringfunc (m *MyModule) Example(name string, value string) *dagger.Gotest {
return dag.
Gotest().
Withenvironmentvariable(name, value)
}@function
def example(name: str, value: str) -> dagger.Gotest:
return (
dag.gotest()
.withenvironmentvariable(name, value)
)@func()
example(name: string, value: string): Gotest {
return dag
.gotest()
.withEnvironmentVariable(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@ad19fa76c14b01850c15fbc471b1ae183154a341 call \
with-module-cachefunc (m *MyModule) Example() *dagger.Gotest {
return dag.
Gotest().
Withmodulecache()
}@function
def example() -> dagger.Gotest:
return (
dag.gotest()
.withmodulecache()
)@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@ad19fa76c14b01850c15fbc471b1ae183154a341 call \
with-build-cachefunc (m *MyModule) Example() *dagger.Gotest {
return dag.
Gotest().
Withbuildcache()
}@function
def example() -> dagger.Gotest:
return (
dag.gotest()
.withbuildcache()
)@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@ad19fa76c14b01850c15fbc471b1ae183154a341 call \
with-go-cachefunc (m *MyModule) Example() *dagger.Gotest {
return dag.
Gotest().
Withgocache()
}@function
def example() -> dagger.Gotest:
return (
dag.gotest()
.withgocache()
)@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
| Name | Type | Default Value | Description |
|---|---|---|---|
| username | String ! | - | No description provided |
| password | String ! | - | No description provided |
Example
dagger -m github.com/Excoriate/daggerverse/gotest@ad19fa76c14b01850c15fbc471b1ae183154a341 call \
with-new-netrc-file-git-hub --username string --password stringfunc (m *MyModule) Example(username string, password string) *dagger.Gotest {
return dag.
Gotest().
Withnewnetrcfilegithub(username, password)
}@function
def example(username: str, password: str) -> dagger.Gotest:
return (
dag.gotest()
.withnewnetrcfilegithub(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
| Name | Type | Default Value | Description |
|---|---|---|---|
| username | String ! | - | No description provided |
| password | String ! | - | No description provided |
Example
dagger -m github.com/Excoriate/daggerverse/gotest@ad19fa76c14b01850c15fbc471b1ae183154a341 call \
with-new-netrc-file-git-lab --username string --password stringfunc (m *MyModule) Example(username string, password string) *dagger.Gotest {
return dag.
Gotest().
Withnewnetrcfilegitlab(username, password)
}@function
def example(username: str, password: str) -> dagger.Gotest:
return (
dag.gotest()
.withnewnetrcfilegitlab(username, password)
)@func()
example(username: string, password: string): Gotest {
return dag
.gotest()
.withNewNetrcFileGitLab(username, password)
}withPrivateGoPkg() 🔗
WithPrivateGoPkg sets the GOPRIVATE environment variable.
Return Type
Gotest !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| privateHost | String ! | - | No description provided |
Example
dagger -m github.com/Excoriate/daggerverse/gotest@ad19fa76c14b01850c15fbc471b1ae183154a341 call \
with-private-go-pkg --private-host stringfunc (m *MyModule) Example(privateHost string) *dagger.Gotest {
return dag.
Gotest().
Withprivategopkg(privateHost)
}@function
def example(privatehost: str) -> dagger.Gotest:
return (
dag.gotest()
.withprivategopkg(privatehost)
)@func()
example(privateHost: string): Gotest {
return dag
.gotest()
.withPrivateGoPkg(privateHost)
}withGcccompiler() 🔗
WithGCCCompiler installs the GCC compiler and musl-dev package.
Return Type
Gotest ! Example
dagger -m github.com/Excoriate/daggerverse/gotest@ad19fa76c14b01850c15fbc471b1ae183154a341 call \
with-gcccompilerfunc (m *MyModule) Example() *dagger.Gotest {
return dag.
Gotest().
Withgcccompiler()
}@function
def example() -> dagger.Gotest:
return (
dag.gotest()
.withgcccompiler()
)@func()
example(): Gotest {
return dag
.gotest()
.withGcccompiler()
}withGoTestSum() 🔗
WithGoTestSum installs the gotestsum CLI.
Return Type
Gotest ! Example
dagger -m github.com/Excoriate/daggerverse/gotest@ad19fa76c14b01850c15fbc471b1ae183154a341 call \
with-go-test-sumfunc (m *MyModule) Example() *dagger.Gotest {
return dag.
Gotest().
Withgotestsum()
}@function
def example() -> dagger.Gotest:
return (
dag.gotest()
.withgotestsum()
)@func()
example(): Gotest {
return dag
.gotest()
.withGoTestSum()
}runGoTest() 🔗
RunGoTest runs tests using the go test CLI. The default packages to test are “./…”.
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| src | Directory ! | - | The directory containing code to test. |
| packages | [String ! ] | - | Packages to test. |
| enableVerbose | Boolean | - | enableVerbose is a flag to run tests with -v. |
| race | Boolean | - | race is a flag to run tests with |
| testFlags | [String ! ] | - | Arbitrary flags to pass along to go test. |
| insecureRootCapabilities | Boolean | - | Whether to run tests insecurely, i.e. with special privileges. |
| nest | Boolean | - | Enable experimental Dagger nesting. |
| enableCache | Boolean | - | enableCache is a flag to enable cache volumes. |
| envVars | [String ! ] | - | No description provided |
| printEnvVars | Boolean | - | printEnvVars is a flag to print the environment variables |
Example
dagger -m github.com/Excoriate/daggerverse/gotest@ad19fa76c14b01850c15fbc471b1ae183154a341 call \
run-go-test --src DIR_PATHfunc (m *MyModule) Example(ctx context.Context, src *dagger.Directory) string {
return dag.
Gotest().
Rungotest(ctx, src)
}@function
async def example(src: dagger.Directory) -> str:
return await (
dag.gotest()
.rungotest(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
| Name | Type | Default Value | Description |
|---|---|---|---|
| src | Directory ! | - | The directory containing code to test. |
| packages | [String ! ] | - | Packages to test. |
| testFlags | [String ! ] | - | Arbitrary flags to pass along to go test. |
| goTestSumFlags | [String ! ] | - | goTestSumFlags is a flag to pass along to go test -json. |
| format | String | - | format defines the option for the GoTestsum format to display |
| insecureRootCapabilities | Boolean | - | Whether to run tests insecurely, i.e. with special privileges. |
| enableNest | Boolean | - | Enable experimental Dagger nesting. It sets the ExperimentalPrivilegedNesting option in Dagger. |
| enableCache | Boolean | - | 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. |
| enablePretty | Boolean | - | enablePretty is a flag to enable pretty output. |
| envVars | [String ! ] | - | envVars list of environment variables to set in the container with format "SOMETHING=SOMETHING,SOMETHING=SOMETHING". |
| printEnvVars | Boolean | - | printEnvVars is a flag to print the environment variables |
Example
dagger -m github.com/Excoriate/daggerverse/gotest@ad19fa76c14b01850c15fbc471b1ae183154a341 call \
run-go-test-sum --src DIR_PATHfunc (m *MyModule) Example(ctx context.Context, src *dagger.Directory) string {
return dag.
Gotest().
Rungotestsum(ctx, src)
}@function
async def example(src: dagger.Directory) -> str:
return await (
dag.gotest()
.rungotestsum(src)
)@func()
async example(src: Directory): Promise<string> {
return dag
.gotest()
.runGoTestSum(src)
}