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@11e29cedf9b2fc92547021b5043d77b28eb65921
Entrypoint
Return Type
Golang
Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@11e29cedf9b2fc92547021b5043d77b28eb65921 call \
func (m *myModule) example() *Golang {
return dag.
Golang()
}
@function
def example() -> dag.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@11e29cedf9b2fc92547021b5043d77b28eb65921 call \
arango-password
func (m *myModule) example(ctx context.Context) string {
return dag.
Golang().
ArangoPassword(ctx)
}
@function
async def example() -> str:
return await (
dag.golang()
.arango_password()
)
@func()
async example(): Promise<string> {
return dag
.golang()
.arangoPassword()
}
arangoVersion() 🔗
Return Type
String !
Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@11e29cedf9b2fc92547021b5043d77b28eb65921 call \
arango-version
func (m *myModule) example(ctx context.Context) string {
return dag.
Golang().
ArangoVersion(ctx)
}
@function
async def example() -> str:
return await (
dag.golang()
.arango_version()
)
@func()
async example(): Promise<string> {
return dag
.golang()
.arangoVersion()
}
arangoPort() 🔗
Return Type
Integer !
Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@11e29cedf9b2fc92547021b5043d77b28eb65921 call \
arango-port
func (m *myModule) example(ctx context.Context) int {
return dag.
Golang().
ArangoPort(ctx)
}
@function
async def example() -> int:
return await (
dag.golang()
.arango_port()
)
@func()
async example(): Promise<number> {
return dag
.golang()
.arangoPort()
}
redisPassword() 🔗
Return Type
String !
Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@11e29cedf9b2fc92547021b5043d77b28eb65921 call \
redis-password
func (m *myModule) example(ctx context.Context) string {
return dag.
Golang().
RedisPassword(ctx)
}
@function
async def example() -> str:
return await (
dag.golang()
.redis_password()
)
@func()
async example(): Promise<string> {
return dag
.golang()
.redisPassword()
}
redisVersion() 🔗
Return Type
String !
Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@11e29cedf9b2fc92547021b5043d77b28eb65921 call \
redis-version
func (m *myModule) example(ctx context.Context) string {
return dag.
Golang().
RedisVersion(ctx)
}
@function
async def example() -> str:
return await (
dag.golang()
.redis_version()
)
@func()
async example(): Promise<string> {
return dag
.golang()
.redisVersion()
}
redisPort() 🔗
Return Type
Integer !
Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@11e29cedf9b2fc92547021b5043d77b28eb65921 call \
redis-port
func (m *myModule) example(ctx context.Context) int {
return dag.
Golang().
RedisPort(ctx)
}
@function
async def example() -> int:
return await (
dag.golang()
.redis_port()
)
@func()
async example(): Promise<number> {
return dag
.golang()
.redisPort()
}
golangVersion() 🔗
Return Type
String !
Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@11e29cedf9b2fc92547021b5043d77b28eb65921 call \
golang-version
func (m *myModule) example(ctx context.Context) string {
return dag.
Golang().
GolangVersion(ctx)
}
@function
async def example() -> str:
return await (
dag.golang()
.golang_version()
)
@func()
async example(): Promise<string> {
return dag
.golang()
.golangVersion()
}
gotestSumFormatter() 🔗
Return Type
String !
Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@11e29cedf9b2fc92547021b5043d77b28eb65921 call \
gotest-sum-formatter
func (m *myModule) example(ctx context.Context) string {
return dag.
Golang().
GotestSumFormatter(ctx)
}
@function
async def example() -> str:
return await (
dag.golang()
.gotest_sum_formatter()
)
@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@11e29cedf9b2fc92547021b5043d77b28eb65921 call \
with-redis-version
func (m *myModule) example() *Golang {
return dag.
Golang().
WithRedisVersion()
}
@function
def example() -> dag.Golang:
return (
dag.golang()
.with_redis_version()
)
@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@11e29cedf9b2fc92547021b5043d77b28eb65921 call \
with-redis-port
func (m *myModule) example() *Golang {
return dag.
Golang().
WithRedisPort()
}
@function
def example() -> dag.Golang:
return (
dag.golang()
.with_redis_port()
)
@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@11e29cedf9b2fc92547021b5043d77b28eb65921 call \
tests-with-redis --src DIR_PATH
func (m *myModule) example(ctx context.Context, src *Directory) string {
return dag.
Golang().
TestsWithRedis(ctx, src)
}
@function
async def example(src: dagger.Directory) -> str:
return await (
dag.golang()
.tests_with_redis(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@11e29cedf9b2fc92547021b5043d77b28eb65921 call \
tests-with-redis-from-github --repository string --git-ref string
func (m *myModule) example(ctx context.Context, repository string, gitRef string) string {
return dag.
Golang().
TestsWithRedisFromGithub(ctx, repository, gitRef)
}
@function
async def example(repository: str, git_ref: str) -> str:
return await (
dag.golang()
.tests_with_redis_from_github(repository, git_ref)
)
@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@11e29cedf9b2fc92547021b5043d77b28eb65921 call \
tests-with-arango-db --src DIR_PATH
func (m *myModule) example(ctx context.Context, src *Directory) string {
return dag.
Golang().
TestsWithArangoDb(ctx, src)
}
@function
async def example(src: dagger.Directory) -> str:
return await (
dag.golang()
.tests_with_arango_db(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@11e29cedf9b2fc92547021b5043d77b28eb65921 call \
tests-with-arango-dbfrom-github --repository string --git-ref string
func (m *myModule) example(ctx context.Context, repository string, gitRef string) string {
return dag.
Golang().
TestsWithArangoDbfromGithub(ctx, repository, gitRef)
}
@function
async def example(repository: str, git_ref: str) -> str:
return await (
dag.golang()
.tests_with_arango_dbfrom_github(repository, git_ref)
)
@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@11e29cedf9b2fc92547021b5043d77b28eb65921 call \
with-arango-port
func (m *myModule) example() *Golang {
return dag.
Golang().
WithArangoPort()
}
@function
def example() -> dag.Golang:
return (
dag.golang()
.with_arango_port()
)
@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@11e29cedf9b2fc92547021b5043d77b28eb65921 call \
with-arango-version
func (m *myModule) example() *Golang {
return dag.
Golang().
WithArangoVersion()
}
@function
def example() -> dag.Golang:
return (
dag.golang()
.with_arango_version()
)
@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@11e29cedf9b2fc92547021b5043d77b28eb65921 call \
with-arango-password
func (m *myModule) example() *Golang {
return dag.
Golang().
WithArangoPassword()
}
@function
def example() -> dag.Golang:
return (
dag.golang()
.with_arango_password()
)
@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@11e29cedf9b2fc92547021b5043d77b28eb65921 call \
test --src DIR_PATH
func (m *myModule) example(ctx context.Context, src *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@11e29cedf9b2fc92547021b5043d77b28eb65921 call \
lint --src DIR_PATH
func (m *myModule) example(ctx context.Context, src *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@11e29cedf9b2fc92547021b5043d77b28eb65921 call \
with-golang-version
func (m *myModule) example() *Golang {
return dag.
Golang().
WithGolangVersion()
}
@function
def example() -> dag.Golang:
return (
dag.golang()
.with_golang_version()
)
@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@11e29cedf9b2fc92547021b5043d77b28eb65921 call \
with-gotest-sum-formatter
func (m *myModule) example() *Golang {
return dag.
Golang().
WithGotestSumFormatter()
}
@function
def example() -> dag.Golang:
return (
dag.golang()
.with_gotest_sum_formatter()
)
@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@11e29cedf9b2fc92547021b5043d77b28eb65921 call \
prepare-test-container
func (m *myModule) example() *Container {
return dag.
Golang().
PrepareTestContainer()
}
@function
def example() -> dagger.Container:
return (
dag.golang()
.prepare_test_container()
)
@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@11e29cedf9b2fc92547021b5043d77b28eb65921 call \
test-git-hub --repository string --git-ref string
func (m *myModule) example(ctx context.Context, repository string, gitRef string) string {
return dag.
Golang().
TestGitHub(ctx, repository, gitRef)
}
@function
async def example(repository: str, git_ref: str) -> str:
return await (
dag.golang()
.test_git_hub(repository, git_ref)
)
@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@11e29cedf9b2fc92547021b5043d77b28eb65921 call \
lint-git-hub --repository string --git-ref string
func (m *myModule) example(ctx context.Context, repository string, gitRef string) string {
return dag.
Golang().
LintGitHub(ctx, repository, gitRef)
}
@function
async def example(repository: str, git_ref: str) -> str:
return await (
dag.golang()
.lint_git_hub(repository, git_ref)
)
@func()
async example(repository: string, gitRef: string): Promise<string> {
return dag
.golang()
.lintGitHub(repository, gitRef)
}