Dagger
Search

go-sdk

No long description provided.

Installation

dagger install github.com/dagger/go-sdk@22e8f55c14a5f16bc695d8845da6acb41236be15

Entrypoint

Return Type
GoSdkMod !
Arguments
NameTypeDefault ValueDescription
pathString !-Workspace-relative path of this module root.
wsWorkspace -Workspace containing this module.
skipGenerateFilenameString !-Marker filename that skips generate when found at or above this module root.
Example
dagger -m github.com/dagger/go-sdk@22e8f55c14a5f16bc695d8845da6acb41236be15 call \
 --path string --skip-generate-filename string
func (m *MyModule) Example(path string, skipGenerateFilename string) *dagger.GoSdkMod  {
	return dag.
			GoSdk(path, skipGenerateFilename)
}
@function
def example(path: str, skip_generate_filename: str) -> dagger.GoSdkMod:
	return (
		dag.go_sdk(path, skip_generate_filename)
	)
@func()
example(path: string, skipGenerateFilename: string): GoSdkMod {
	return dag
		.goSdk(path, skipGenerateFilename)
}

Entrypoint

Return Type
GoSdkTemplate !
Arguments
NameTypeDefault ValueDescription
nameString !-Template name passed to init.
sourceDirectory !-Template source files materialized into the new module before generation.
Example
Function GoSdkTemplate.Constructor is not accessible from the go-sdk module
Function GoSdkTemplate.Constructor is not accessible from the go-sdk module
Function GoSdkTemplate.Constructor is not accessible from the go-sdk module
Function GoSdkTemplate.Constructor is not accessible from the go-sdk module

Entrypoint

Return Type
GoSdk !
Arguments
NameTypeDefault ValueDescription
skipGenerateFilenameString -Marker filename that skips generate when found at or above a Go SDK module root.
Example
dagger -m github.com/dagger/go-sdk@22e8f55c14a5f16bc695d8845da6acb41236be15 call \
func (m *MyModule) Example() *dagger.GoSdk  {
	return dag.
			GoSdk()
}
@function
def example() -> dagger.GoSdk:
	return (
		dag.go_sdk()
	)
@func()
example(): GoSdk {
	return dag
		.goSdk()
}

Types

GoSdkMod 🔗

A Dagger module that uses the Go SDK.

path() 🔗

Workspace-relative path of this module root.

Return Type
String !
Example
echo 'Custom types are not supported in shell examples'
func (m *MyModule) Example(ctx context.Context) string  {
	return dag.
			GoSdk().
			Mod().
			Path(ctx)
}
@function
async def example() -> str:
	return await (
		dag.go_sdk()
		.mod()
		.path()
	)
@func()
async example(): Promise<string> {
	return dag
		.goSdk()
		.mod()
		.path()
}

skipGenerate() 🔗

Whether this module or an ancestor contains the configured generate skip marker.

Return Type
Boolean !
Arguments
NameTypeDefault ValueDescription
wsWorkspace -No description provided
Example
echo 'Custom types are not supported in shell examples'
func (m *MyModule) Example(ctx context.Context) bool  {
	return dag.
			GoSdk().
			Mod().
			SkipGenerate(ctx)
}
@function
async def example() -> bool:
	return await (
		dag.go_sdk()
		.mod()
		.skip_generate()
	)
@func()
async example(): Promise<boolean> {
	return dag
		.goSdk()
		.mod()
		.skipGenerate()
}

generate() 🔗

Generate this module. If the generate skip marker is present, the changeset is empty.

Return Type
Changeset !
Arguments
NameTypeDefault ValueDescription
wsWorkspace -No description provided
Example
echo 'Custom types are not supported in shell examples'
func (m *MyModule) Example() *dagger.Changeset  {
	return dag.
			GoSdk().
			Mod().
			Generate()
}
@function
def example() -> dagger.Changeset:
	return (
		dag.go_sdk()
		.mod()
		.generate()
	)
@func()
example(): Changeset {
	return dag
		.goSdk()
		.mod()
		.generate()
}

GoSdkTemplate 🔗

An init template tracked by this module.

name() 🔗

Template name passed to init.

Return Type
String !
Example
Function GoSdkTemplate.name is not accessible from the go-sdk module
Function GoSdkTemplate.name is not accessible from the go-sdk module
Function GoSdkTemplate.name is not accessible from the go-sdk module
Function GoSdkTemplate.name is not accessible from the go-sdk module

source() 🔗

Template source files materialized into the new module before generation.

Return Type
Directory !
Example
Function GoSdkTemplate.source is not accessible from the go-sdk module
Function GoSdkTemplate.source is not accessible from the go-sdk module
Function GoSdkTemplate.source is not accessible from the go-sdk module
Function GoSdkTemplate.source is not accessible from the go-sdk module

GoSdk 🔗

Manage Dagger modules that use the Go SDK.

skipGenerateFilename() 🔗

Marker filename that skips generate when found at or above a Go SDK module root.

Return Type
String !
Example
dagger -m github.com/dagger/go-sdk@22e8f55c14a5f16bc695d8845da6acb41236be15 call \
 skip-generate-filename
func (m *MyModule) Example(ctx context.Context) string  {
	return dag.
			GoSdk().
			SkipGenerateFilename(ctx)
}
@function
async def example() -> str:
	return await (
		dag.go_sdk()
		.skip_generate_filename()
	)
@func()
async example(): Promise<string> {
	return dag
		.goSdk()
		.skipGenerateFilename()
}

targetRuntime() 🔗

Runtime source to write into modules created by this SDK.

Return Type
String !
Example
dagger -m github.com/dagger/go-sdk@22e8f55c14a5f16bc695d8845da6acb41236be15 call \
 target-runtime
func (m *MyModule) Example(ctx context.Context) string  {
	return dag.
			GoSdk().
			TargetRuntime(ctx)
}
@function
async def example() -> str:
	return await (
		dag.go_sdk()
		.target_runtime()
	)
@func()
async example(): Promise<string> {
	return dag
		.goSdk()
		.targetRuntime()
}

modules() 🔗

Return every legacy dagger.json Dagger module whose sdk.source is “go”.

Return Type
[GoSdkMod ! ] !
Arguments
NameTypeDefault ValueDescription
wsWorkspace -No description provided
Example
echo 'Custom types are not supported in shell examples'
func (m *MyModule) Example() []*dagger.GoSdkMod  {
	return dag.
			GoSdk().
			Modules()
}
@function
def example() -> List[dagger.GoSdkMod]:
	return (
		dag.go_sdk()
		.modules()
	)
@func()
example(): GoSdkMod[] {
	return dag
		.goSdk()
		.modules()
}

templates() 🔗

Return init templates tracked by this module.

Templates live under templates/ and are materialized into the new module. Passing an empty template to init uses the module default.

Return Type
[GoSdkTemplate ! ] !
Example
dagger -m github.com/dagger/go-sdk@22e8f55c14a5f16bc695d8845da6acb41236be15 call \
 templates
func (m *MyModule) Example() []*dagger.GoSdkTemplate  {
	return dag.
			GoSdk().
			Templates()
}
@function
def example() -> List[dagger.GoSdkTemplate]:
	return (
		dag.go_sdk()
		.templates()
	)
@func()
example(): GoSdkTemplate[] {
	return dag
		.goSdk()
		.templates()
}

mod() 🔗

Return the Go SDK module at or above a workspace path.

When findUp is true, path may point inside the module.

Return Type
GoSdkMod !
Arguments
NameTypeDefault ValueDescription
wsWorkspace -No description provided
pathString -No description provided
findUpBoolean -No description provided
Example
echo 'Custom types are not supported in shell examples'
func (m *MyModule) Example() *dagger.GoSdkMod  {
	return dag.
			GoSdk().
			Mod()
}
@function
def example() -> dagger.GoSdkMod:
	return (
		dag.go_sdk()
		.mod()
	)
@func()
example(): GoSdkMod {
	return dag
		.goSdk()
		.mod()
}

initModule() 🔗

Initialize Go-owned files for a new Dagger module.

Pass template to materialize files from templates/. The empty default uses this module’s minimal template.

Return Type
Changeset !
Arguments
NameTypeDefault ValueDescription
wsWorkspace -No description provided
nameString !-No description provided
pathString !-No description provided
templateString -No description provided
Example
echo 'Custom types are not supported in shell examples'
func (m *MyModule) Example(name string, path string) *dagger.Changeset  {
	return dag.
			GoSdk().
			InitModule(name, path)
}
@function
def example(name: str, path: str) -> dagger.Changeset:
	return (
		dag.go_sdk()
		.init_module(name, path)
	)
@func()
example(name: string, path: string): Changeset {
	return dag
		.goSdk()
		.initModule(name, path)
}

initClient() 🔗

Generate a typed Go client for module at path.

The engine records the managed client in workspace config before calling this function. The engine owns materializing the generated client files.

Return Type
Changeset !
Arguments
NameTypeDefault ValueDescription
wsWorkspace -No description provided
pathString !-No description provided
moduleString !-No description provided
devBoolean -No description provided
Example
echo 'Custom types are not supported in shell examples'
func (m *MyModule) Example(path string, module string) *dagger.Changeset  {
	return dag.
			GoSdk().
			InitClient(path, module)
}
@function
def example(path: str, module: str) -> dagger.Changeset:
	return (
		dag.go_sdk()
		.init_client(path, module)
	)
@func()
example(path: string, module: string): Changeset {
	return dag
		.goSdk()
		.initClient(path, module)
}

generateAll() 🔗

Generate all discovered legacy dagger.json Go SDK modules.

This discovery path is obsolete for workspace-managed modules; the engine owns the modules..as-sdk.modules source of truth.

Modules with the generate skip marker are skipped.

Return Type
Changeset !
Arguments
NameTypeDefault ValueDescription
wsWorkspace -No description provided
Example
echo 'Custom types are not supported in shell examples'
func (m *MyModule) Example() *dagger.Changeset  {
	return dag.
			GoSdk().
			GenerateAll()
}
@function
def example() -> dagger.Changeset:
	return (
		dag.go_sdk()
		.generate_all()
	)
@func()
example(): Changeset {
	return dag
		.goSdk()
		.generateAll()
}