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@37bae1658a8c2549adca856283b60ef067fbef12
Entrypoint
Return Type
Golang
Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@37bae1658a8c2549adca856283b60ef067fbef12 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 🔗
test() 🔗
Runs golang tests
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
version | String | "go-1.21" | An optional Go version to use for testing |
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@37bae1658a8c2549adca856283b60ef067fbef12 call \
test --src DIR_PATH
func (m *myModule) example(ctx context.Context, src *Directory) string {
return dag.
Golang().
Test(ctxsrc)
}
@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
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@37bae1658a8c2549adca856283b60ef067fbef12 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)
}
publish() 🔗
Publish builds and pushes a Docker image to a Docker registry.
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
src | String | "." | specifies the source directory where the Docker context is located |
namespace | String | "dictybase" | the docker namespace under which the image will be pushed |
dockerFile | String | "build/package/Dockerfile" | specifies the path to the Dockerfile |
image | String ! | - | name of the image to be built, Required |
imageTag | String ! | - | tag of the image to be built, Required |
Example
dagger -m github.com/dictybase-docker/dagger-of-dcr/golang@37bae1658a8c2549adca856283b60ef067fbef12 call \
publish --image string --image-tag string
func (m *myModule) example(ctx context.Context, image string, imageTag string) string {
return dag.
Golang().
Publish(ctximage, imageTag)
}
@function
async def example(image: str, image_tag: str) -> str:
return await (
dag.golang()
.publish(image, image_tag)
)
@func()
async example(image: string, imageTag: string): Promise<string> {
return dag
.golang()
.publish(image, imageTag)
}