Dagger
Search

go

Copyright © 2024 Patrick Hermann patrick.hermann@sva.de

Installation

dagger install github.com/stuttgart-things/dagger/go@v0.31.1

Entrypoint

Return Type
Go !
Arguments
NameTypeDefault ValueDescription
goLangContainerContainer -golang container It need contain golang
koContainerContainer -No description provided
goLangVersionString "1.23.6"No description provided
srcDirectory -No description provided
Example
dagger -m github.com/stuttgart-things/dagger/go@84dba75d6eadbe852472475f14929a7743787cce call \
func (m *MyModule) Example() *dagger.Go  {
	return dag.
			Go()
}
@function
def example() -> dagger.Go:
	return (
		dag.go()
	)
@func()
example(): Go {
	return dag
		.go()
}

Types

Go 🔗

src() 🔗

Return Type
Directory !
Example
dagger -m github.com/stuttgart-things/dagger/go@84dba75d6eadbe852472475f14929a7743787cce call \
 src
func (m *MyModule) Example() *dagger.Directory  {
	return dag.
			Go().
			Src()
}
@function
def example() -> dagger.Directory:
	return (
		dag.go()
		.src()
	)
@func()
example(): Directory {
	return dag
		.go()
		.src()
}

goLangContainer() 🔗

Return Type
Container !
Example
dagger -m github.com/stuttgart-things/dagger/go@84dba75d6eadbe852472475f14929a7743787cce call \
 go-lang-container
func (m *MyModule) Example() *dagger.Container  {
	return dag.
			Go().
			GoLangContainer()
}
@function
def example() -> dagger.Container:
	return (
		dag.go()
		.go_lang_container()
	)
@func()
example(): Container {
	return dag
		.go()
		.goLangContainer()
}

koContainer() 🔗

Return Type
Container !
Example
dagger -m github.com/stuttgart-things/dagger/go@84dba75d6eadbe852472475f14929a7743787cce call \
 ko-container
func (m *MyModule) Example() *dagger.Container  {
	return dag.
			Go().
			KoContainer()
}
@function
def example() -> dagger.Container:
	return (
		dag.go()
		.ko_container()
	)
@func()
example(): Container {
	return dag
		.go()
		.koContainer()
}

test() 🔗

Return Type
String !
Arguments
NameTypeDefault ValueDescription
srcDirectory !-No description provided
goVersionString "1.24.4"Go version to use for testing
testArgString "./..."Test arguments to pass to `go test`
Example
dagger -m github.com/stuttgart-things/dagger/go@84dba75d6eadbe852472475f14929a7743787cce call \
 test --src DIR_PATH
func (m *MyModule) Example(ctx context.Context, src *dagger.Directory) string  {
	return dag.
			Go().
			Test(ctx, src)
}
@function
async def example(src: dagger.Directory) -> str:
	return await (
		dag.go()
		.test(src)
	)
@func()
async example(src: Directory): Promise<string> {
	return dag
		.go()
		.test(src)
}

securityScan() 🔗

Return Type
File !
Arguments
NameTypeDefault ValueDescription
srcDirectory !-No description provided
secureGoVersionString "2.22.7"No description provided
Example
dagger -m github.com/stuttgart-things/dagger/go@84dba75d6eadbe852472475f14929a7743787cce call \
 security-scan --src DIR_PATH
func (m *MyModule) Example(src *dagger.Directory) *dagger.File  {
	return dag.
			Go().
			SecurityScan(src)
}
@function
def example(src: dagger.Directory) -> dagger.File:
	return (
		dag.go()
		.security_scan(src)
	)
@func()
example(src: Directory): File {
	return dag
		.go()
		.securityScan(src)
}

buildBinary() 🔗

Return Type
Directory !
Arguments
NameTypeDefault ValueDescription
srcDirectory !-No description provided
goVersionString "1.24.2"No description provided
osString "linux"No description provided
archString "amd64"No description provided
goMainFileString "main.go"No description provided
binNameString "main"No description provided
ldflagsString -No description provided
packageNameString ""No description provided
Example
dagger -m github.com/stuttgart-things/dagger/go@84dba75d6eadbe852472475f14929a7743787cce call \
 build-binary --src DIR_PATH
func (m *MyModule) Example(src *dagger.Directory) *dagger.Directory  {
	return dag.
			Go().
			BuildBinary(src)
}
@function
def example(src: dagger.Directory) -> dagger.Directory:
	return (
		dag.go()
		.build_binary(src)
	)
@func()
example(src: Directory): Directory {
	return dag
		.go()
		.buildBinary(src)
}

build() 🔗

Return Type
Directory !
Arguments
NameTypeDefault ValueDescription
srcDirectory !-No description provided
optsBuildOpts !-Use the struct for parameters
Example
echo 'Custom types are not supported in shell examples'
func (m *MyModule) Example(src *dagger.Directory, opts *dagger.GoBuildOpts) *dagger.Directory  {
	return dag.
			Go().
			Build(src, opts)
}
@function
def example(src: dagger.Directory, opts: dagger.GoBuildOpts) -> dagger.Directory:
	return (
		dag.go()
		.build(src, opts)
	)
@func()
example(src: Directory, opts: GoBuildOpts): Directory {
	return dag
		.go()
		.build(src, opts)
}

lint() 🔗

Lint runs the linter on the provided source code

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
srcDirectory !-No description provided
timeoutString "500s"No description provided
Example
dagger -m github.com/stuttgart-things/dagger/go@84dba75d6eadbe852472475f14929a7743787cce call \
 lint --src DIR_PATH
func (m *MyModule) Example(src *dagger.Directory) *dagger.Container  {
	return dag.
			Go().
			Lint(src)
}
@function
def example(src: dagger.Directory) -> dagger.Container:
	return (
		dag.go()
		.lint(src)
	)
@func()
example(src: Directory): Container {
	return dag
		.go()
		.lint(src)
}

koBuild() 🔗

Return Type
String !
Arguments
NameTypeDefault ValueDescription
srcDirectory !-No description provided
tokenNameString "GITHUB_TOKEN"No description provided
tokenSecret -No description provided
repoString "ko.local"No description provided
buildArgString "."No description provided
koVersionString "v0.18.0"No description provided
pushString "true"No description provided
Example
dagger -m github.com/stuttgart-things/dagger/go@84dba75d6eadbe852472475f14929a7743787cce call \
 ko-build --src DIR_PATH
func (m *MyModule) Example(ctx context.Context, src *dagger.Directory) string  {
	return dag.
			Go().
			KoBuild(ctx, src)
}
@function
async def example(src: dagger.Directory) -> str:
	return await (
		dag.go()
		.ko_build(src)
	)
@func()
async example(src: Directory): Promise<string> {
	return dag
		.go()
		.koBuild(src)
}

getGoLangContainer() 🔗

GetGoLangContainer returns the default image for golang

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
goVersionString !-No description provided
Example
dagger -m github.com/stuttgart-things/dagger/go@84dba75d6eadbe852472475f14929a7743787cce call \
 get-go-lang-container --go-version string
func (m *MyModule) Example(goVersion string) *dagger.Container  {
	return dag.
			Go().
			GetGoLangContainer(goVersion)
}
@function
def example(go_version: str) -> dagger.Container:
	return (
		dag.go()
		.get_go_lang_container(go_version)
	)
@func()
example(goVersion: string): Container {
	return dag
		.go()
		.getGoLangContainer(goVersion)
}

getKoContainer() 🔗

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
koVersionString "v0.17.1"No description provided
Example
dagger -m github.com/stuttgart-things/dagger/go@84dba75d6eadbe852472475f14929a7743787cce call \
 get-ko-container
func (m *MyModule) Example() *dagger.Container  {
	return dag.
			Go().
			GetKoContainer()
}
@function
def example() -> dagger.Container:
	return (
		dag.go()
		.get_ko_container()
	)
@func()
example(): Container {
	return dag
		.go()
		.getKoContainer()
}

BuildOpts 🔗

goVersion() 🔗

Return Type
String !
Example
Function GoBuildOpts.goVersion is not accessible from the go module
Function GoBuildOpts.goVersion is not accessible from the go module
Function GoBuildOpts.goVersion is not accessible from the go module
Function GoBuildOpts.goVersion is not accessible from the go module

os() 🔗

Return Type
String !
Example
Function GoBuildOpts.os is not accessible from the go module
Function GoBuildOpts.os is not accessible from the go module
Function GoBuildOpts.os is not accessible from the go module
Function GoBuildOpts.os is not accessible from the go module

arch() 🔗

Return Type
String !
Example
Function GoBuildOpts.arch is not accessible from the go module
Function GoBuildOpts.arch is not accessible from the go module
Function GoBuildOpts.arch is not accessible from the go module
Function GoBuildOpts.arch is not accessible from the go module

goMainFile() 🔗

Return Type
String !
Example
Function GoBuildOpts.goMainFile is not accessible from the go module
Function GoBuildOpts.goMainFile is not accessible from the go module
Function GoBuildOpts.goMainFile is not accessible from the go module
Function GoBuildOpts.goMainFile is not accessible from the go module

binName() 🔗

Return Type
String !
Example
Function GoBuildOpts.binName is not accessible from the go module
Function GoBuildOpts.binName is not accessible from the go module
Function GoBuildOpts.binName is not accessible from the go module
Function GoBuildOpts.binName is not accessible from the go module

ldflags() 🔗

Add this field for linker flags

Return Type
String !
Example
Function GoBuildOpts.ldflags is not accessible from the go module
Function GoBuildOpts.ldflags is not accessible from the go module
Function GoBuildOpts.ldflags is not accessible from the go module
Function GoBuildOpts.ldflags is not accessible from the go module

packageName() 🔗

Return Type
String !
Example
Function GoBuildOpts.packageName is not accessible from the go module
Function GoBuildOpts.packageName is not accessible from the go module
Function GoBuildOpts.packageName is not accessible from the go module
Function GoBuildOpts.packageName is not accessible from the go module