go
Copyright © 2024 Patrick Hermann patrick.hermann@sva.de
Installation
dagger install github.com/stuttgart-things/dagger/go@v0.4.1Entrypoint
Return Type
Go !Arguments
| Name | Type | Default Value | Description | 
|---|---|---|---|
| goLangContainer | Container | - | golang container It need contain golang | 
| koContainer | Container | - | No description provided | 
| goLangVersion | String | "1.23.6" | No description provided | 
| src | Directory | - | No description provided | 
Example
dagger -m github.com/stuttgart-things/dagger/go@76e17d826c2553a468eea6328353d7ebdaf9c208 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@76e17d826c2553a468eea6328353d7ebdaf9c208 call \
 srcfunc (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@76e17d826c2553a468eea6328353d7ebdaf9c208 call \
 go-lang-containerfunc (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@76e17d826c2553a468eea6328353d7ebdaf9c208 call \
 ko-containerfunc (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()
}getGoLangContainer() 🔗
GetGoLangContainer returns the default image for golang
Return Type
Container !Arguments
| Name | Type | Default Value | Description | 
|---|---|---|---|
| goVersion | String ! | - | No description provided | 
Example
dagger -m github.com/stuttgart-things/dagger/go@76e17d826c2553a468eea6328353d7ebdaf9c208 call \
 get-go-lang-container --go-version stringfunc (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
| Name | Type | Default Value | Description | 
|---|---|---|---|
| koVersion | String | "v0.17.1" | No description provided | 
Example
dagger -m github.com/stuttgart-things/dagger/go@76e17d826c2553a468eea6328353d7ebdaf9c208 call \
 get-ko-containerfunc (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()
}runWorkflowEntryStage() 🔗
Return Type
File !Arguments
| Name | Type | Default Value | Description | 
|---|---|---|---|
| src | Directory ! | - | No description provided | 
| lintTimeout | String | "500s" | No description provided | 
| goVersion | String | "1.23.6" | No description provided | 
| os | String | "linux" | No description provided | 
| arch | String | "amd64" | No description provided | 
| goMainFile | String | "main.go" | No description provided | 
| binName | String | "main" | No description provided | 
| secureGoVersion | String | "2.22.1" | No description provided | 
| lintCanFail | Boolean | "false" | If true, linting can fail without stopping the workflow | 
| testArg | String | "./..." | Arguments for `go test` | 
| securityScanCanFail | Boolean | "false" | If true, security scan can fail without stopping the workflow | 
| trivyScanCanFail | Boolean | "false" | If true, Trivy scan can fail without stopping the workflow | 
| trivySeverity | String | "HIGH,CRITICAL" | Severity levels to include (e.g., "HIGH,CRITICAL") | 
| trivyVersion | String | "0.59.1" | No description provided | 
Example
dagger -m github.com/stuttgart-things/dagger/go@76e17d826c2553a468eea6328353d7ebdaf9c208 call \
 run-workflow-entry-stage --src DIR_PATHfunc (m *MyModule) Example(src *dagger.Directory) *dagger.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
| Name | Type | Default Value | Description | 
|---|---|---|---|
| src | Directory ! | - | No description provided | 
| timeout | String | "500s" | No description provided | 
Example
dagger -m github.com/stuttgart-things/dagger/go@76e17d826c2553a468eea6328353d7ebdaf9c208 call \
 lint --src DIR_PATHfunc (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)
}scanTarBallImage() 🔗
Lint runs the linter on the provided source code
Return Type
File !Arguments
| Name | Type | Default Value | Description | 
|---|---|---|---|
| file | File ! | - | No description provided | 
Example
dagger -m github.com/stuttgart-things/dagger/go@76e17d826c2553a468eea6328353d7ebdaf9c208 call \
 scan-tar-ball-image --file file:pathfunc (m *MyModule) Example(file *dagger.File) *dagger.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
| Name | Type | Default Value | Description | 
|---|---|---|---|
| src | Directory ! | - | No description provided | 
| tokenName | String | "GITHUB_TOKEN" | No description provided | 
| token | Secret ! | - | No description provided | 
| repo | String | "ko.local" | No description provided | 
| buildArg | String | "." | No description provided | 
| koVersion | String | "v0.17.1" | No description provided | 
| push | String | "true" | No description provided | 
| severityFilter | String | "HIGH,CRITICAL" | Comma-separated list of severities to filter (e.g., "HIGH,CRITICAL") | 
Example
dagger -m github.com/stuttgart-things/dagger/go@76e17d826c2553a468eea6328353d7ebdaf9c208 call \
 ko-build-and-scan --src DIR_PATH --token env:MYSECRETfunc (m *MyModule) Example(ctx context.Context, src *dagger.Directory, token *dagger.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
| Name | Type | Default Value | Description | 
|---|---|---|---|
| scanResult | File ! | - | No description provided | 
| severityFilter | String ! | - | Comma-separated list of severities (e.g., "HIGH,CRITICAL") | 
Example
dagger -m github.com/stuttgart-things/dagger/go@76e17d826c2553a468eea6328353d7ebdaf9c208 call \
 search-vulnerabilities --scan-result file:path --severity-filter stringfunc (m *MyModule) Example(ctx context.Context, scanResult *dagger.File, severityFilter string) []string  {
	return dag.
			Go().
			SearchVulnerabilities(ctx, scanResult, severityFilter)
}@function
async def example(scan_result: dagger.File, severity_filter: str) -> List[str]:
	return await (
		dag.go()
		.search_vulnerabilities(scan_result, severity_filter)
	)@func()
async example(scanResult: File, severityFilter: string): Promise<string[]> {
	return dag
		.go()
		.searchVulnerabilities(scanResult, severityFilter)
}build() 🔗
Returns lines that match a pattern in the files of the provided Directory
Return Type
Directory !Arguments
| Name | Type | Default Value | Description | 
|---|---|---|---|
| goVersion | String | "1.23.6" | No description provided | 
| os | String | "linux" | No description provided | 
| arch | String | "amd64" | No description provided | 
| goMainFile | String | "main.go" | No description provided | 
| binName | String | "main" | No description provided | 
| src | Directory ! | - | No description provided | 
Example
dagger -m github.com/stuttgart-things/dagger/go@76e17d826c2553a468eea6328353d7ebdaf9c208 call \
 build --src DIR_PATHfunc (m *MyModule) Example(src *dagger.Directory) *dagger.Directory  {
	return dag.
			Go().
			Build(src)
}@function
def example(src: dagger.Directory) -> dagger.Directory:
	return (
		dag.go()
		.build(src)
	)@func()
example(src: Directory): Directory {
	return dag
		.go()
		.build(src)
}koBuild() 🔗
Returns lines that match a pattern in the files of the provided Directory
Return Type
Directory !Arguments
| Name | Type | Default Value | Description | 
|---|---|---|---|
| src | Directory ! | - | No description provided | 
| tokenName | String | "GITHUB_TOKEN" | No description provided | 
| token | Secret ! | - | No description provided | 
| repo | String | "ko.local" | No description provided | 
| buildArg | String | "." | No description provided | 
| koVersion | String | "v0.17.1" | No description provided | 
| push | String | "true" | No description provided | 
Example
dagger -m github.com/stuttgart-things/dagger/go@76e17d826c2553a468eea6328353d7ebdaf9c208 call \
 ko-build --src DIR_PATH --token env:MYSECRETfunc (m *MyModule) Example(src *dagger.Directory, token *dagger.Secret) *dagger.Directory  {
	return dag.
			Go().
			KoBuild(src, token)
}@function
def example(src: dagger.Directory, token: dagger.Secret) -> dagger.Directory:
	return (
		dag.go()
		.ko_build(src, token)
	)@func()
example(src: Directory, token: Secret): Directory {
	return dag
		.go()
		.koBuild(src, token)
}test() 🔗
Return Type
String !Arguments
| Name | Type | Default Value | Description | 
|---|---|---|---|
| src | Directory ! | - | No description provided | 
| goVersion | String ! | - | Go version to use for testing | 
| testArg | String | "./..." | Arguments for `go test` | 
Example
dagger -m github.com/stuttgart-things/dagger/go@76e17d826c2553a468eea6328353d7ebdaf9c208 call \
 test --src DIR_PATH --go-version stringfunc (m *MyModule) Example(ctx context.Context, src *dagger.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
| Name | Type | Default Value | Description | 
|---|---|---|---|
| src | Directory ! | - | No description provided | 
| severity | String | "HIGH,CRITICAL" | Severity levels to include (e.g., "HIGH,CRITICAL") | 
| trivyVersion | String | "0.59.1" | No description provided | 
Example
dagger -m github.com/stuttgart-things/dagger/go@76e17d826c2553a468eea6328353d7ebdaf9c208 call \
 trivy-scan --src DIR_PATHfunc (m *MyModule) Example(src *dagger.Directory) *dagger.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
| Name | Type | Default Value | Description | 
|---|---|---|---|
| src | Directory ! | - | No description provided | 
| secureGoVersion | String | "2.22.1" | No description provided | 
Example
dagger -m github.com/stuttgart-things/dagger/go@76e17d826c2553a468eea6328353d7ebdaf9c208 call \
 security-scan --src DIR_PATHfunc (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)
}