Dagger
Search

go-dagger

This module has been generated via dagger init and serves as a reference to basic module structure as you get started with Dagger.

Two functions have been pre-created. You can modify, delete, or add to them, as needed. They demonstrate usage of arguments and return types using simple echo and grep commands. The functions can be called from the dagger CLI or from one of the SDKs.

The first line in this comment block is a short description line and the rest is a long description with more detail on the module's purpose or usage, if appropriate. All modules should have a short description.

Installation

dagger install github.com/felipecruz91/daggerverse/go@19f96a0cb541100a73ce024280e50305608a1e60

Entrypoint

Return Type
GoDagger
Example
func (m *myModule) example() *GoDagger  {
	return dag.
			GoDagger()
}
@function
def example() -> dag.GoDagger:
	return (
		dag.go_dagger()
	)
@func()
example(): GoDagger {
	return dag
		.goDagger()
}

Types

GoDagger 🔗

test() 🔗

Test runs the Go tests

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
sourceDirectory !-source is the directory containing the Go source code
goVersionString "1.22.0"goVersion is the version of Go to use for building the binary
ignoreCacheBoolean falseignoreCache is a flag to ignore the cache
raceBoolean falserace is a flag to include Go's built-in data race detector
verboseBoolean falseverbose is a flag to enable verbose output
Example
dagger -m github.com/felipecruz91/daggerverse/go@19f96a0cb541100a73ce024280e50305608a1e60 call \
 test --source DIR_PATH
func (m *myModule) example(source *Directory) *Container  {
	return dag.
			GoDagger().
			Test(source)
}
@function
def example(source: dagger.Directory) -> dagger.Container:
	return (
		dag.go_dagger()
		.test(source)
	)
@func()
example(source: Directory): Container {
	return dag
		.goDagger()
		.test(source)
}

lint() 🔗

Lint runs the Go linter

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
sourceDirectory !-source is the directory containing the Go source code
golangCilintImageString "golangci/golangci-lint:v1.57.2"golangCILintImage is the container image to use for the linter
timeoutString "5m"timeout is the maximum time to run the linter
verboseBoolean falseverbose is a flag to enable verbose output
Example
dagger -m github.com/felipecruz91/daggerverse/go@19f96a0cb541100a73ce024280e50305608a1e60 call \
 lint --source DIR_PATH
func (m *myModule) example(source *Directory) *Container  {
	return dag.
			GoDagger().
			Lint(source)
}
@function
def example(source: dagger.Directory) -> dagger.Container:
	return (
		dag.go_dagger()
		.lint(source)
	)
@func()
example(source: Directory): Container {
	return dag
		.goDagger()
		.lint(source)
}

dockerBuild() 🔗

DockerBuild packages the Go binary into a Docker container

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
binDirectory !-bin is the directory containing the cross-platform Go binaries
goVersionString "1.22.0"goVersion is the version of Go to use for building the binary
platformString -platform is the platform to build the binary for
Example
dagger -m github.com/felipecruz91/daggerverse/go@19f96a0cb541100a73ce024280e50305608a1e60 call \
 docker-build --bin DIR_PATH
func (m *myModule) example(bin *Directory) *Container  {
	return dag.
			GoDagger().
			DockerBuild(bin)
}
@function
def example(bin: dagger.Directory) -> dagger.Container:
	return (
		dag.go_dagger()
		.docker_build(bin)
	)
@func()
example(bin: Directory): Container {
	return dag
		.goDagger()
		.dockerBuild(bin)
}

build() 🔗

Build builds the Go binary for the specified go version and platforms

Return Type
Directory !
Arguments
NameTypeDefault ValueDescription
sourceDirectory !-source is the directory containing the Go source code
goVersionString "1.22.0"goVersion is the version of Go to use for building the binary
platforms[String ! ] ["linux/amd64", "linux/arm64"]platforms is the list of platforms to build the binary for
Example
dagger -m github.com/felipecruz91/daggerverse/go@19f96a0cb541100a73ce024280e50305608a1e60 call \
 build --source DIR_PATH
func (m *myModule) example(source *Directory) *Directory  {
	return dag.
			GoDagger().
			Build(source)
}
@function
def example(source: dagger.Directory) -> dagger.Directory:
	return (
		dag.go_dagger()
		.build(source)
	)
@func()
example(source: Directory): Directory {
	return dag
		.goDagger()
		.build(source)
}