Dagger
Search

go

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

Installation

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

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@58db206a4d5ef59081d423feae628888c8ecd605 call \
func (m *myModule) example() *Go  {
	return dag.
			Go()
}
@function
def example() -> dag.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@58db206a4d5ef59081d423feae628888c8ecd605 call \
 src
func (m *myModule) example() *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@58db206a4d5ef59081d423feae628888c8ecd605 call \
 go-lang-container
func (m *myModule) example() *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@58db206a4d5ef59081d423feae628888c8ecd605 call \
 ko-container
func (m *myModule) example() *Container  {
	return dag.
			Go().
			KoContainer()
}
@function
def example() -> dagger.Container:
	return (
		dag.go()
		.ko_container()
	)
@func()
example(): Container {
	return dag
		.go()
		.koContainer()
}

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@58db206a4d5ef59081d423feae628888c8ecd605 call \
 get-go-lang-container --go-version string
func (m *myModule) example(goVersion string) *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@58db206a4d5ef59081d423feae628888c8ecd605 call \
 get-ko-container
func (m *myModule) example() *Container  {
	return dag.
			Go().
			GetKoContainer()
}
@function
def example() -> dagger.Container:
	return (
		dag.go()
		.get_ko_container()
	)
@func()
example(): Container {
	return dag
		.go()
		.getKoContainer()
}

runWorkflowEntryStage() 🔗

Return Type
File !
Arguments
NameTypeDefault ValueDescription
srcDirectory !-No description provided
lintTimeoutString "500s"No description provided
goVersionString "1.23.6"No description provided
osString "linux"No description provided
archString "amd64"No description provided
goMainFileString "main.go"No description provided
binNameString "main"No description provided
secureGoVersionString "2.22.1"No description provided
lintCanFailBoolean "false"If true, linting can fail without stopping the workflow
testArgString "./..."Arguments for `go test`
securityScanCanFailBoolean "false"If true, security scan can fail without stopping the workflow
trivyScanCanFailBoolean "false"If true, Trivy scan can fail without stopping the workflow
trivySeverityString "HIGH,CRITICAL"Severity levels to include (e.g., "HIGH,CRITICAL")
trivyVersionString "0.59.1"No description provided
Example
dagger -m github.com/stuttgart-things/dagger/go@58db206a4d5ef59081d423feae628888c8ecd605 call \
 run-workflow-entry-stage --src DIR_PATH
func (m *myModule) example(src *Directory) *File  {
	return dag.
			Go().
			RunWorkflowEntryStage(src)
}
@function
def example(src: dagger.Directory) -> dagger.File:
	return (
		dag.go()
		.run_workflow_entry_stage(src)
	)
@func()
example(src: Directory): File {
	return dag
		.go()
		.runWorkflowEntryStage(src)
}

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@58db206a4d5ef59081d423feae628888c8ecd605 call \
 lint --src DIR_PATH
func (m *myModule) example(src *Directory) *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)
}

scanTarBallImage() 🔗

Lint runs the linter on the provided source code

Return Type
File !
Arguments
NameTypeDefault ValueDescription
fileFile !-No description provided
Example
dagger -m github.com/stuttgart-things/dagger/go@58db206a4d5ef59081d423feae628888c8ecd605 call \
 scan-tar-ball-image --file file:path
func (m *myModule) example(file *File) *File  {
	return dag.
			Go().
			ScanTarBallImage(file)
}
@function
def example(file: dagger.File) -> dagger.File:
	return (
		dag.go()
		.scan_tar_ball_image(file)
	)
@func()
example(file: File): File {
	return dag
		.go()
		.scanTarBallImage(file)
}

koBuildAndScan() 🔗

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.17.1"No description provided
pushString "true"No description provided
severityFilterString "HIGH,CRITICAL"Comma-separated list of severities to filter (e.g., "HIGH,CRITICAL")
Example
dagger -m github.com/stuttgart-things/dagger/go@58db206a4d5ef59081d423feae628888c8ecd605 call \
 ko-build-and-scan --src DIR_PATH --token env:MYSECRET
func (m *myModule) example(ctx context.Context, src *Directory, token *Secret) string  {
	return dag.
			Go().
			KoBuildAndScan(ctx, src, token)
}
@function
async def example(src: dagger.Directory, token: dagger.Secret) -> str:
	return await (
		dag.go()
		.ko_build_and_scan(src, token)
	)
@func()
async example(src: Directory, token: Secret): Promise<string> {
	return dag
		.go()
		.koBuildAndScan(src, token)
}

searchVulnerabilities() 🔗

SearchVulnerabilities parses the Trivy scan report and filters vulnerabilities by severity

Return Type
[String ! ] !
Arguments
NameTypeDefault ValueDescription
scanOutputString !-The scan output as a string
severityFilterString !-Comma-separated list of severities to filter (e.g., "HIGH,CRITICAL")
Example
dagger -m github.com/stuttgart-things/dagger/go@58db206a4d5ef59081d423feae628888c8ecd605 call \
 search-vulnerabilities --scan-output string --severity-filter string
func (m *myModule) example(ctx context.Context, scanOutput string, severityFilter string) []string  {
	return dag.
			Go().
			SearchVulnerabilities(ctx, scanOutput, severityFilter)
}
@function
async def example(scan_output: str, severity_filter: str) -> List[str]:
	return await (
		dag.go()
		.search_vulnerabilities(scan_output, severity_filter)
	)
@func()
async example(scanOutput: string, severityFilter: string): Promise<string[]> {
	return dag
		.go()
		.searchVulnerabilities(scanOutput, severityFilter)
}

binary() 🔗

Return Type
Directory !
Arguments
NameTypeDefault ValueDescription
srcDirectory !-No description provided
goVersionString "1.23.6"No description provided
osString "linux"No description provided
archString "amd64"No description provided
goMainFileString "main.go"No description provided
binNameString "main"No description provided
Example
dagger -m github.com/stuttgart-things/dagger/go@58db206a4d5ef59081d423feae628888c8ecd605 call \
 binary --src DIR_PATH
func (m *myModule) example(src *Directory) *Directory  {
	return dag.
			Go().
			Binary(src)
}
@function
def example(src: dagger.Directory) -> dagger.Directory:
	return (
		dag.go()
		.binary(src)
	)
@func()
example(src: Directory): Directory {
	return dag
		.go()
		.binary(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 *Directory, opts *GoBuildOpts) *Directory  {
	return dag.
			Go().
			Build(src, opts)
}
@function
def example(src: dagger.Directory, opts: dag.GoBuildOpts) -> dagger.Directory:
	return (
		dag.go()
		.build(src, opts)
	)
@func()
example(src: Directory, opts: GoBuildOpts): Directory {
	return dag
		.go()
		.build(src, opts)
}

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.17.1"No description provided
pushString "true"No description provided
Example
dagger -m github.com/stuttgart-things/dagger/go@58db206a4d5ef59081d423feae628888c8ecd605 call \
 ko-build --src DIR_PATH --token env:MYSECRET
func (m *myModule) example(ctx context.Context, src *Directory, token *Secret) string  {
	return dag.
			Go().
			KoBuild(ctx, src, token)
}
@function
async def example(src: dagger.Directory, token: dagger.Secret) -> str:
	return await (
		dag.go()
		.ko_build(src, token)
	)
@func()
async example(src: Directory, token: Secret): Promise<string> {
	return dag
		.go()
		.koBuild(src, token)
}

test() 🔗

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

trivyScan() 🔗

Return Type
File !
Arguments
NameTypeDefault ValueDescription
srcDirectory !-No description provided
severityString "HIGH,CRITICAL"Severity levels to include (e.g., "HIGH,CRITICAL")
trivyVersionString "0.59.1"No description provided
Example
dagger -m github.com/stuttgart-things/dagger/go@58db206a4d5ef59081d423feae628888c8ecd605 call \
 trivy-scan --src DIR_PATH
func (m *myModule) example(src *Directory) *File  {
	return dag.
			Go().
			TrivyScan(src)
}
@function
def example(src: dagger.Directory) -> dagger.File:
	return (
		dag.go()
		.trivy_scan(src)
	)
@func()
example(src: Directory): File {
	return dag
		.go()
		.trivyScan(src)
}

securityScan() 🔗

Return Type
File !
Arguments
NameTypeDefault ValueDescription
srcDirectory !-No description provided
secureGoVersionString "2.22.1"No description provided
Example
dagger -m github.com/stuttgart-things/dagger/go@58db206a4d5ef59081d423feae628888c8ecd605 call \
 security-scan --src DIR_PATH
func (m *myModule) example(src *Directory) *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)
}

runWorkflowContainerStage() 🔗

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.17.1"No description provided
pushString "true"No description provided
severityFilterString "HIGH,CRITICAL"Comma-separated list of severities to filter (e.g., "HIGH,CRITICAL")
Example
dagger -m github.com/stuttgart-things/dagger/go@58db206a4d5ef59081d423feae628888c8ecd605 call \
 run-workflow-container-stage --src DIR_PATH --token env:MYSECRET
func (m *myModule) example(ctx context.Context, src *Directory, token *Secret) string  {
	return dag.
			Go().
			RunWorkflowContainerStage(ctx, src, token)
}
@function
async def example(src: dagger.Directory, token: dagger.Secret) -> str:
	return await (
		dag.go()
		.run_workflow_container_stage(src, token)
	)
@func()
async example(src: Directory, token: Secret): Promise<string> {
	return dag
		.go()
		.runWorkflowContainerStage(src, token)
}

scanRemoteImage() 🔗

Return Type
String !
Arguments
NameTypeDefault ValueDescription
imageAddressString !-Remote image address (e.g., "ko.local/my-image:latest")
severityFilterString !-Comma-separated list of severities to filter (e.g., "HIGH,CRITICAL")
Example
dagger -m github.com/stuttgart-things/dagger/go@58db206a4d5ef59081d423feae628888c8ecd605 call \
 scan-remote-image --image-address string --severity-filter string
func (m *myModule) example(ctx context.Context, imageAddress string, severityFilter string) string  {
	return dag.
			Go().
			ScanRemoteImage(ctx, imageAddress, severityFilter)
}
@function
async def example(image_address: str, severity_filter: str) -> str:
	return await (
		dag.go()
		.scan_remote_image(image_address, severity_filter)
	)
@func()
async example(imageAddress: string, severityFilter: string): Promise<string> {
	return dag
		.go()
		.scanRemoteImage(imageAddress, severityFilter)
}

BuildOpts 🔗

goVersion() 🔗

+optional

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() 🔗

+optional

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() 🔗

+optional

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() 🔗

+optional

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() 🔗

+optional

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