go
No long description provided.
Installation
dagger install github.com/dagger/go@90865d00d690ea99ca60e97785fed23100e65711Entrypoint
Return Type
Go !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| version | String | - | Go version used for test and generate commands. |
| includeExtraFiles | [String ! ] | - | Extra workspace-root include patterns mounted for each module's Go commands. Use this for fixtures, generator inputs, or other files not covered by the built-in Go patterns. |
| goModulesMustOptIn | Boolean | - | Require each Go module to contain the opt-in marker before tests or generate run. |
| goModuleOptInFilename | String | - | Opt-in marker filename checked at each Go module root. Only used when goModulesMustOptIn is true. |
Example
dagger -m github.com/dagger/go@90865d00d690ea99ca60e97785fed23100e65711 call \
func (m *MyModule) Example() *dagger.Go {
return dag.
Go()
}@function
def example() -> dagger.Go:
return (
dag.go()
)@func()
example(): Go {
return dag
.go()
}Entrypoint
Return Type
Module !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| path | String ! | - | Workspace-relative path of this module root. |
| version | String ! | - | Go version used by this module's test and generate containers. |
| includeExtraFiles | [String ! ] ! | - | Extra workspace-root include patterns mounted for this module's Go commands. |
| mustOptIn | Boolean ! | - | Whether this module requires an opt-in marker before tests or generate run. |
| optInFilename | String ! | - | Marker filename used when this module must opt in. |
Example
Function Module.Constructor is not accessible from the go moduleFunction Module.Constructor is not accessible from the go moduleFunction Module.Constructor is not accessible from the go moduleFunction Module.Constructor is not accessible from the go moduleTypes
Go 🔗
A Dagger module for Go - a programming language for building simple, secure, scalable systems. https://dagger.io https://golang.org
goModulesMustOptIn() 🔗
Require each Go module to contain the opt-in marker before tests or generate run.
Return Type
Boolean ! Example
dagger -m github.com/dagger/go@90865d00d690ea99ca60e97785fed23100e65711 call \
go-modules-must-opt-infunc (m *MyModule) Example(ctx context.Context) bool {
return dag.
Go().
GoModulesMustOptIn(ctx)
}@function
async def example() -> bool:
return await (
dag.go()
.go_modules_must_opt_in()
)@func()
async example(): Promise<boolean> {
return dag
.go()
.goModulesMustOptIn()
}goModuleOptInFilename() 🔗
Opt-in marker filename checked at each Go module root. Only used when goModulesMustOptIn is true.
Return Type
String ! Example
dagger -m github.com/dagger/go@90865d00d690ea99ca60e97785fed23100e65711 call \
go-module-opt-in-filenamefunc (m *MyModule) Example(ctx context.Context) string {
return dag.
Go().
GoModuleOptInFilename(ctx)
}@function
async def example() -> str:
return await (
dag.go()
.go_module_opt_in_filename()
)@func()
async example(): Promise<string> {
return dag
.go()
.goModuleOptInFilename()
}includeExtraFiles() 🔗
Extra workspace-root include patterns mounted for each module’s Go commands. Use this for fixtures, generator inputs, or other files not covered by the built-in Go patterns.
Return Type
[String ! ] ! Example
dagger -m github.com/dagger/go@90865d00d690ea99ca60e97785fed23100e65711 call \
include-extra-filesfunc (m *MyModule) Example(ctx context.Context) []string {
return dag.
Go().
IncludeExtraFiles(ctx)
}@function
async def example() -> List[str]:
return await (
dag.go()
.include_extra_files()
)@func()
async example(): Promise<string[]> {
return dag
.go()
.includeExtraFiles()
}version() 🔗
Go version used for test and generate commands.
Return Type
String ! Example
dagger -m github.com/dagger/go@90865d00d690ea99ca60e97785fed23100e65711 call \
versionfunc (m *MyModule) Example(ctx context.Context) string {
return dag.
Go().
Version(ctx)
}@function
async def example() -> str:
return await (
dag.go()
.version()
)@func()
async example(): Promise<string> {
return dag
.go()
.version()
}testAll() 🔗
Run tests in every discovered Go module. When opt-in is required, modules without the marker are skipped.
Return Type
Void !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| ws | Workspace | - | No description provided |
Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example(ctx context.Context) {
return dag.
Go().
TestAll(ctx)
}@function
async def example() -> None:
return await (
dag.go()
.test_all()
)@func()
async example(): Promise<void> {
return dag
.go()
.testAll()
}modules() 🔗
Return every Go module discovered from workspace go.mod files.
Return Type
[Module ! ] !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| ws | Workspace | - | No description provided |
Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example() []*dagger.GoModule {
return dag.
Go().
Modules()
}@function
def example() -> List[dagger.GoModule]:
return (
dag.go()
.modules()
)@func()
example(): GoModule[] {
return dag
.go()
.modules()
}module() 🔗
Return the Go module containing a workspace path.
By default, path may be a module root or a directory inside a module. Set findUp to false when path is already a module root and no lookup is needed.
Return Type
Module !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| ws | Workspace | - | No description provided |
| path | String ! | - | No description provided |
| findUp | Boolean | - | No description provided |
Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example(path string) *dagger.GoModule {
return dag.
Go().
Module(path)
}@function
def example(path: str) -> dagger.GoModule:
return (
dag.go()
.module(path)
)@func()
example(path: string): GoModule {
return dag
.go()
.module(path)
}generate() 🔗
Run go generate in every discovered Go module. When opt-in is required, modules without the marker are skipped.
Return Type
Changeset !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| ws | Workspace | - | No description provided |
Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example() *dagger.Changeset {
return dag.
Go().
Generate()
}@function
def example() -> dagger.Changeset:
return (
dag.go()
.generate()
)@func()
example(): Changeset {
return dag
.go()
.generate()
}Module 🔗
A Go module rooted at a workspace-relative path.
version() 🔗
Go version used by this module’s test and generate containers.
Return Type
String ! Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example(ctx context.Context, path string) string {
return dag.
Go().
Module(path).
Version(ctx)
}@function
async def example(path: str) -> str:
return await (
dag.go()
.module(path)
.version()
)@func()
async example(path: string): Promise<string> {
return dag
.go()
.module(path)
.version()
}includeExtraFiles() 🔗
Extra workspace-root include patterns mounted for this module’s Go commands.
Return Type
[String ! ] ! Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example(ctx context.Context, path string) []string {
return dag.
Go().
Module(path).
IncludeExtraFiles(ctx)
}@function
async def example(path: str) -> List[str]:
return await (
dag.go()
.module(path)
.include_extra_files()
)@func()
async example(path: string): Promise<string[]> {
return dag
.go()
.module(path)
.includeExtraFiles()
}mustOptIn() 🔗
Whether this module requires an opt-in marker before tests or generate run.
Return Type
Boolean ! Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example(ctx context.Context, path string) bool {
return dag.
Go().
Module(path).
MustOptIn(ctx)
}@function
async def example(path: str) -> bool:
return await (
dag.go()
.module(path)
.must_opt_in()
)@func()
async example(path: string): Promise<boolean> {
return dag
.go()
.module(path)
.mustOptIn()
}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, path string) string {
return dag.
Go().
Module(path).
Path(ctx)
}@function
async def example(path: str) -> str:
return await (
dag.go()
.module(path)
.path()
)@func()
async example(path: string): Promise<string> {
return dag
.go()
.module(path)
.path()
}optedIn() 🔗
Whether this module root contains the configured opt-in marker.
Return Type
Boolean !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| ws | Workspace | - | No description provided |
Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example(ctx context.Context, path string) bool {
return dag.
Go().
Module(path).
OptedIn(ctx)
}@function
async def example(path: str) -> bool:
return await (
dag.go()
.module(path)
.opted_in()
)@func()
async example(path: string): Promise<boolean> {
return dag
.go()
.module(path)
.optedIn()
}source() 🔗
Workspace source mounted for this module’s Go commands.
Return Type
Directory !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| ws | Workspace | - | No description provided |
Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example(path string) *dagger.Directory {
return dag.
Go().
Module(path).
Source()
}@function
def example(path: str) -> dagger.Directory:
return (
dag.go()
.module(path)
.source()
)@func()
example(path: string): Directory {
return dag
.go()
.module(path)
.source()
}generate() 🔗
Module directory after running go generate. When opt-in is required and this module has no marker, the source is returned unchanged.
Return Type
Directory !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| ws | Workspace | - | No description provided |
Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example(path string) *dagger.Directory {
return dag.
Go().
Module(path).
Generate()
}@function
def example(path: str) -> dagger.Directory:
return (
dag.go()
.module(path)
.generate()
)@func()
example(path: string): Directory {
return dag
.go()
.module(path)
.generate()
}include() 🔗
Final workspace include patterns used to build this module’s source directory.
Return Type
[String ! ] !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| ws | Workspace | - | No description provided |
Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example(ctx context.Context, path string) []string {
return dag.
Go().
Module(path).
Include(ctx)
}@function
async def example(path: str) -> List[str]:
return await (
dag.go()
.module(path)
.include()
)@func()
async example(path: string): Promise<string[]> {
return dag
.go()
.module(path)
.include()
}base() 🔗
Base Go container before source files and commands are added.
Return Type
Container ! Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example(path string) *dagger.Container {
return dag.
Go().
Module(path).
Base()
}@function
def example(path: str) -> dagger.Container:
return (
dag.go()
.module(path)
.base()
)@func()
example(path: string): Container {
return dag
.go()
.module(path)
.base()
}shouldIgnore() 🔗
Whether tests and generate should skip this module under the current opt-in policy.
Return Type
Boolean !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| ws | Workspace | - | No description provided |
Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example(ctx context.Context, path string) bool {
return dag.
Go().
Module(path).
ShouldIgnore(ctx)
}@function
async def example(path: str) -> bool:
return await (
dag.go()
.module(path)
.should_ignore()
)@func()
async example(path: string): Promise<boolean> {
return dag
.go()
.module(path)
.shouldIgnore()
}includeFromGoDirectives() 🔗
Workspace include patterns discovered from go:embed and workspace:include directives in this module’s Go files.
Return Type
[String ! ] !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| ws | Workspace | - | No description provided |
Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example(ctx context.Context, path string) []string {
return dag.
Go().
Module(path).
IncludeFromGoDirectives(ctx)
}@function
async def example(path: str) -> List[str]:
return await (
dag.go()
.module(path)
.include_from_go_directives()
)@func()
async example(path: string): Promise<string[]> {
return dag
.go()
.module(path)
.includeFromGoDirectives()
}includeFromGoModReplace() 🔗
Workspace include patterns discovered from this module’s local go.mod replace directives.
Return Type
[String ! ] !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| ws | Workspace | - | No description provided |
Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example(ctx context.Context, path string) []string {
return dag.
Go().
Module(path).
IncludeFromGoModReplace(ctx)
}@function
async def example(path: str) -> List[str]:
return await (
dag.go()
.module(path)
.include_from_go_mod_replace()
)@func()
async example(path: string): Promise<string[]> {
return dag
.go()
.module(path)
.includeFromGoModReplace()
}includeBase() 🔗
Built-in workspace include patterns for this module’s own Go source files.
Return Type
[String ! ] ! Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example(ctx context.Context, path string) []string {
return dag.
Go().
Module(path).
IncludeBase(ctx)
}@function
async def example(path: str) -> List[str]:
return await (
dag.go()
.module(path)
.include_base()
)@func()
async example(path: string): Promise<string[]> {
return dag
.go()
.module(path)
.includeBase()
}testData() 🔗
Workspace testdata directories mounted while testing this module.
Return Type
Directory !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| ws | Workspace | - | No description provided |
Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example(path string) *dagger.Directory {
return dag.
Go().
Module(path).
TestData()
}@function
def example(path: str) -> dagger.Directory:
return (
dag.go()
.module(path)
.test_data()
)@func()
example(path: string): Directory {
return dag
.go()
.module(path)
.testData()
}test() 🔗
Run tests in this module. When opt-in is required and this module has no marker, tests are skipped.
Return Type
Void !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| ws | Workspace | - | No description provided |
Example
echo 'Custom types are not supported in shell examples'func (m *MyModule) Example(ctx context.Context, path string) {
return dag.
Go().
Module(path).
Test(ctx)
}@function
async def example(path: str) -> None:
return await (
dag.go()
.module(path)
.test()
)@func()
async example(path: string): Promise<void> {
return dag
.go()
.module(path)
.test()
}