golang
Package main provides a set of functions to run Go language tests within a containerized environment.
Installation
dagger install github.com/dictybase-docker/dagger-of-dcr/golang@a0e3a23539553aabc8af8749da3abfdfdcc96081Entrypoint
Return Type
Golang Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@a0e3a23539553aabc8af8749da3abfdfdcc96081 call \
func (m *MyModule) Example() *dagger.Golang {
return dag.
Golang()
}@function
def example() -> dagger.Golang:
return (
dag.golang()
)@func()
example(): Golang {
return dag
.golang()
}Types
Golang 🔗
arangoPassword() 🔗
Return Type
String ! Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@a0e3a23539553aabc8af8749da3abfdfdcc96081 call \
arango-passwordfunc (m *MyModule) Example(ctx context.Context) string {
return dag.
Golang().
Arangopassword(ctx)
}@function
async def example() -> str:
return await (
dag.golang()
.arangopassword()
)@func()
async example(): Promise<string> {
return dag
.golang()
.arangoPassword()
}arangoVersion() 🔗
Return Type
String ! Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@a0e3a23539553aabc8af8749da3abfdfdcc96081 call \
arango-versionfunc (m *MyModule) Example(ctx context.Context) string {
return dag.
Golang().
Arangoversion(ctx)
}@function
async def example() -> str:
return await (
dag.golang()
.arangoversion()
)@func()
async example(): Promise<string> {
return dag
.golang()
.arangoVersion()
}arangoPort() 🔗
Return Type
Integer ! Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@a0e3a23539553aabc8af8749da3abfdfdcc96081 call \
arango-portfunc (m *MyModule) Example(ctx context.Context) int {
return dag.
Golang().
Arangoport(ctx)
}@function
async def example() -> int:
return await (
dag.golang()
.arangoport()
)@func()
async example(): Promise<number> {
return dag
.golang()
.arangoPort()
}redisPassword() 🔗
Return Type
String ! Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@a0e3a23539553aabc8af8749da3abfdfdcc96081 call \
redis-passwordfunc (m *MyModule) Example(ctx context.Context) string {
return dag.
Golang().
Redispassword(ctx)
}@function
async def example() -> str:
return await (
dag.golang()
.redispassword()
)@func()
async example(): Promise<string> {
return dag
.golang()
.redisPassword()
}redisVersion() 🔗
Return Type
String ! Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@a0e3a23539553aabc8af8749da3abfdfdcc96081 call \
redis-versionfunc (m *MyModule) Example(ctx context.Context) string {
return dag.
Golang().
Redisversion(ctx)
}@function
async def example() -> str:
return await (
dag.golang()
.redisversion()
)@func()
async example(): Promise<string> {
return dag
.golang()
.redisVersion()
}redisPort() 🔗
Return Type
Integer ! Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@a0e3a23539553aabc8af8749da3abfdfdcc96081 call \
redis-portfunc (m *MyModule) Example(ctx context.Context) int {
return dag.
Golang().
Redisport(ctx)
}@function
async def example() -> int:
return await (
dag.golang()
.redisport()
)@func()
async example(): Promise<number> {
return dag
.golang()
.redisPort()
}golangVersion() 🔗
Return Type
String ! Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@a0e3a23539553aabc8af8749da3abfdfdcc96081 call \
golang-versionfunc (m *MyModule) Example(ctx context.Context) string {
return dag.
Golang().
Golangversion(ctx)
}@function
async def example() -> str:
return await (
dag.golang()
.golangversion()
)@func()
async example(): Promise<string> {
return dag
.golang()
.golangVersion()
}gotestSumFormatter() 🔗
Return Type
String ! Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@a0e3a23539553aabc8af8749da3abfdfdcc96081 call \
gotest-sum-formatterfunc (m *MyModule) Example(ctx context.Context) string {
return dag.
Golang().
Gotestsumformatter(ctx)
}@function
async def example() -> str:
return await (
dag.golang()
.gotestsumformatter()
)@func()
async example(): Promise<string> {
return dag
.golang()
.gotestSumFormatter()
}withRedisVersion() 🔗
WithRedisVersion sets the version of Redis to use.
Return Type
Golang !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| version | String | "7.0.12" | The version of Redis to use |
Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@a0e3a23539553aabc8af8749da3abfdfdcc96081 call \
with-redis-versionfunc (m *MyModule) Example() *dagger.Golang {
return dag.
Golang().
Withredisversion()
}@function
def example() -> dagger.Golang:
return (
dag.golang()
.withredisversion()
)@func()
example(): Golang {
return dag
.golang()
.withRedisVersion()
}withRedisPort() 🔗
WithRedisPort sets the port to expose Redis on.
Return Type
Golang !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| port | Integer | 6379 | The port to expose Redis on |
Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@a0e3a23539553aabc8af8749da3abfdfdcc96081 call \
with-redis-portfunc (m *MyModule) Example() *dagger.Golang {
return dag.
Golang().
Withredisport()
}@function
def example() -> dagger.Golang:
return (
dag.golang()
.withredisport()
)@func()
example(): Golang {
return dag
.golang()
.withRedisPort()
}testsWithRedis() 🔗
TestsWithRedis runs Go tests in a container with Redis.
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| src | Directory ! | - | The source directory to test, Required. |
| args | [String ! ] | - | An optional slice of strings representing additional arguments to the go test command |
Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@a0e3a23539553aabc8af8749da3abfdfdcc96081 call \
tests-with-redis --src DIR_PATHfunc (m *MyModule) Example(ctx context.Context, src *dagger.Directory) string {
return dag.
Golang().
Testswithredis(ctx, src)
}@function
async def example(src: dagger.Directory) -> str:
return await (
dag.golang()
.testswithredis(src)
)@func()
async example(src: Directory): Promise<string> {
return dag
.golang()
.testsWithRedis(src)
}testsWithRedisFromGithub() 🔗
TestsWithRedisFromGithub fetches a GitHub repository and runs Go tests with Redis.
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| repository | String ! | - | The GitHub repository name (e.g., “username/repo”) |
| gitRef | String ! | - | The git reference (branch, tag, or commit) to clone and test |
| args | [String ! ] | - | An optional slice of strings representing additional arguments to the go test command |
Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@a0e3a23539553aabc8af8749da3abfdfdcc96081 call \
tests-with-redis-from-github --repository string --git-ref stringfunc (m *MyModule) Example(ctx context.Context, repository string, gitRef string) string {
return dag.
Golang().
Testswithredisfromgithub(ctx, repository, gitRef)
}@function
async def example(repository: str, gitref: str) -> str:
return await (
dag.golang()
.testswithredisfromgithub(repository, gitref)
)@func()
async example(repository: string, gitRef: string): Promise<string> {
return dag
.golang()
.testsWithRedisFromGithub(repository, gitRef)
}testsWithArangoDb() 🔗
TestsWithArangoDB runs Go tests in a container with an ArangoDB.
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| src | Directory ! | - | The source directory to test, Required. |
| args | [String ! ] | - | An optional slice of strings representing additional arguments to the go test command |
Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@a0e3a23539553aabc8af8749da3abfdfdcc96081 call \
tests-with-arango-db --src DIR_PATHfunc (m *MyModule) Example(ctx context.Context, src *dagger.Directory) string {
return dag.
Golang().
Testswitharangodb(ctx, src)
}@function
async def example(src: dagger.Directory) -> str:
return await (
dag.golang()
.testswitharangodb(src)
)@func()
async example(src: Directory): Promise<string> {
return dag
.golang()
.testsWithArangoDb(src)
}testsWithArangoDbfromGithub() 🔗
TestsWithArangoDBFromGithub fetches a GitHub repository and runs Go tests with ArangoDB.
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| repository | String ! | - | The GitHub repository name (e.g., “username/repo”) |
| gitRef | String ! | - | The git reference (branch, tag, or commit) to clone and test |
| args | [String ! ] | - | An optional slice of strings representing additional arguments to the go test command |
Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@a0e3a23539553aabc8af8749da3abfdfdcc96081 call \
tests-with-arango-dbfrom-github --repository string --git-ref stringfunc (m *MyModule) Example(ctx context.Context, repository string, gitRef string) string {
return dag.
Golang().
Testswitharangodbfromgithub(ctx, repository, gitRef)
}@function
async def example(repository: str, gitref: str) -> str:
return await (
dag.golang()
.testswitharangodbfromgithub(repository, gitref)
)@func()
async example(repository: string, gitRef: string): Promise<string> {
return dag
.golang()
.testsWithArangoDbfromGithub(repository, gitRef)
}withArangoPort() 🔗
WithArangoPort sets the port to expose ArangoDB on.
Return Type
Golang !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| port | Integer | 8529 | The port to expose ArangoDB on |
Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@a0e3a23539553aabc8af8749da3abfdfdcc96081 call \
with-arango-portfunc (m *MyModule) Example() *dagger.Golang {
return dag.
Golang().
Witharangoport()
}@function
def example() -> dagger.Golang:
return (
dag.golang()
.witharangoport()
)@func()
example(): Golang {
return dag
.golang()
.withArangoPort()
}withArangoVersion() 🔗
WithArangoVersion sets the version of ArangoDB to use.
Return Type
Golang !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| version | String | "3.10.9" | The version of ArangoDB to use |
Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@a0e3a23539553aabc8af8749da3abfdfdcc96081 call \
with-arango-versionfunc (m *MyModule) Example() *dagger.Golang {
return dag.
Golang().
Witharangoversion()
}@function
def example() -> dagger.Golang:
return (
dag.golang()
.witharangoversion()
)@func()
example(): Golang {
return dag
.golang()
.withArangoVersion()
}withArangoPassword() 🔗
WithArangoPassword sets the root password for the ArangoDB instance.
Return Type
Golang !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| password | String | "golam" | The root password for the ArangoDB instance |
Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@a0e3a23539553aabc8af8749da3abfdfdcc96081 call \
with-arango-passwordfunc (m *MyModule) Example() *dagger.Golang {
return dag.
Golang().
Witharangopassword()
}@function
def example() -> dagger.Golang:
return (
dag.golang()
.witharangopassword()
)@func()
example(): Golang {
return dag
.golang()
.withArangoPassword()
}test() 🔗
Test runs Go tests
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| src | Directory ! | - | The source directory to test, Required. |
| args | [String ! ] | - | An optional slice of strings representing additional arguments to the go test command |
Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@a0e3a23539553aabc8af8749da3abfdfdcc96081 call \
test --src DIR_PATHfunc (m *MyModule) Example(ctx context.Context, src *dagger.Directory) string {
return dag.
Golang().
Test(ctx, src)
}@function
async def example(src: dagger.Directory) -> str:
return await (
dag.golang()
.test(src)
)@func()
async example(src: Directory): Promise<string> {
return dag
.golang()
.test(src)
}lint() 🔗
Lint runs golangci-lint on the Go source code in a containerized environment. It uses a specified version of golangci-lint to perform static code analysis.
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| version | String | "v1.55.2-alpine" | An optional string specifying the version of golangci-lint to use |
| src | Directory ! | - | The source directory to test, Required. |
| args | [String ! ] | - | An optional slice of strings representing additional arguments to the golangci-lint command |
Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@a0e3a23539553aabc8af8749da3abfdfdcc96081 call \
lint --src DIR_PATHfunc (m *MyModule) Example(ctx context.Context, src *dagger.Directory) string {
return dag.
Golang().
Lint(ctxsrc)
}@function
async def example(src: dagger.Directory) -> str:
return await (
dag.golang()
.lint(src)
)@func()
async example(src: Directory): Promise<string> {
return dag
.golang()
.lint(src)
}withGolangVersion() 🔗
WithGolangVersion sets the version of Golang to use.
Return Type
Golang !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| version | String | "1.22.6" | The version of Golang to use |
Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@a0e3a23539553aabc8af8749da3abfdfdcc96081 call \
with-golang-versionfunc (m *MyModule) Example() *dagger.Golang {
return dag.
Golang().
Withgolangversion()
}@function
def example() -> dagger.Golang:
return (
dag.golang()
.withgolangversion()
)@func()
example(): Golang {
return dag
.golang()
.withGolangVersion()
}withGotestSumFormatter() 🔗
WithGotestSumFormatter sets the output formatter for gotestsum
Return Type
Golang !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| formatter | String | "pkgname" | The output formatter to use for gotestsum |
Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@a0e3a23539553aabc8af8749da3abfdfdcc96081 call \
with-gotest-sum-formatterfunc (m *MyModule) Example() *dagger.Golang {
return dag.
Golang().
Withgotestsumformatter()
}@function
def example() -> dagger.Golang:
return (
dag.golang()
.withgotestsumformatter()
)@func()
example(): Golang {
return dag
.golang()
.withGotestSumFormatter()
}prepareTestContainer() 🔗
PrepareTestContainer creates a container with Golang and installs gotestsum and gotestdox
Return Type
Container ! Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@a0e3a23539553aabc8af8749da3abfdfdcc96081 call \
prepare-test-containerfunc (m *MyModule) Example() *dagger.Container {
return dag.
Golang().
Preparetestcontainer()
}@function
def example() -> dagger.Container:
return (
dag.golang()
.preparetestcontainer()
)@func()
example(): Container {
return dag
.golang()
.prepareTestContainer()
}testGitHub() 🔗
TestGitHub runs Go tests on a GitHub repository
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| repository | String ! | - | The GitHub repository name (e.g., “username/repo”) |
| gitRef | String ! | - | The git reference (branch, tag, or commit) to clone and test |
| args | [String ! ] | - | An optional slice of strings representing additional arguments to the go test command |
Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@a0e3a23539553aabc8af8749da3abfdfdcc96081 call \
test-git-hub --repository string --git-ref stringfunc (m *MyModule) Example(ctx context.Context, repository string, gitRef string) string {
return dag.
Golang().
Testgithub(ctx, repository, gitRef)
}@function
async def example(repository: str, gitref: str) -> str:
return await (
dag.golang()
.testgithub(repository, gitref)
)@func()
async example(repository: string, gitRef: string): Promise<string> {
return dag
.golang()
.testGitHub(repository, gitRef)
}lintGitHub() 🔗
LintGitHub runs golangci-lint on a GitHub repository
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| repository | String ! | - | The GitHub repository name (e.g., “username/repo”) |
| gitRef | String ! | - | The git reference (branch, tag, or commit) to clone and lint |
| version | String | "v1.55.2-alpine" | An optional string specifying the version of golangci-lint to use |
| args | [String ! ] | - | An optional slice of strings representing additional arguments to the golangci-lint command |
Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@a0e3a23539553aabc8af8749da3abfdfdcc96081 call \
lint-git-hub --repository string --git-ref stringfunc (m *MyModule) Example(ctx context.Context, repository string, gitRef string) string {
return dag.
Golang().
Lintgithub(ctx, repository, gitRef)
}@function
async def example(repository: str, gitref: str) -> str:
return await (
dag.golang()
.lintgithub(repository, gitref)
)@func()
async example(repository: string, gitRef: string): Promise<string> {
return dag
.golang()
.lintGitHub(repository, gitRef)
}