go
No long description provided.
Installation
dagger install github.com/dagger/go@8255884bcfc1937a3a2f639f989e784428c0c1e4Entrypoint
Return Type
Directory !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| path | String ! | - | Workspace-relative path of this directory. |
| ws | Workspace | - | Workspace containing this directory. |
| modulePath | String ! | - | Workspace-relative path of this directory's Go module root. |
| version | String ! | - | Go version used by this directory's test container. |
| includeExtraFiles | [String ! ] ! | - | Extra workspace-root include patterns mounted for this directory's Go tests. |
| skipTestFilename | String ! | - | Marker filename that skips tests when found at or above this directory's Go module root. |
| testSkipMarkers | [String ! ] ! | - | No description provided |
Example
Function Directory.Constructor is not accessible from the go moduleFunction Directory.Constructor is not accessible from the go moduleFunction Directory.Constructor is not accessible from the go moduleFunction Directory.Constructor is not accessible from the go moduleEntrypoint
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. |
| skipLintFilename | String ! | - | Marker filename that skips lint checks when found at or above this module root. |
| skipTestFilename | String ! | - | Marker filename that skips tests when found at or above this module root. |
| skipGenerateFilename | String ! | - | Marker filename that skips go generate when found at or above this module root. |
| lintSkipMarkers | [String ! ] ! | - | No description provided |
| testSkipMarkers | [String ! ] ! | - | No description provided |
| generateSkipMarkers | [String ! ] ! | - | No description provided |
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 moduleEntrypoint
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. |
| skipLintFilename | String | - | Marker filename that skips lint checks when found at or above a Go module root. |
| skipTestFilename | String | - | Marker filename that skips tests when found at or above a Go module root. |
| skipGenerateFilename | String | - | Marker filename that skips go generate when found at or above a Go module root. |
Example
dagger -m github.com/dagger/go@8255884bcfc1937a3a2f639f989e784428c0c1e4 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
Directory 🔗
A workspace directory containing Go test files.
path() 🔗
Workspace-relative path of this directory.
Return Type
String ! Example
Function GoDirectory.path is not accessible from the go moduleFunction GoDirectory.path is not accessible from the go moduleFunction GoDirectory.path is not accessible from the go moduleFunction GoDirectory.path is not accessible from the go moduleexecute() 🔗
Run Go tests in this directory.
Return Type
Void ! Example
Function GoDirectory.execute is not accessible from the go moduleFunction GoDirectory.execute is not accessible from the go moduleFunction GoDirectory.execute is not accessible from the go moduleFunction GoDirectory.execute is not accessible from the go moduleModule 🔗
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()
}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()
}skipGenerate() 🔗
Whether this module or an ancestor contains the configured generate skip 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).
SkipGenerate(ctx)
}@function
async def example(path: str) -> bool:
return await (
dag.go()
.module(path)
.skip_generate()
)@func()
async example(path: string): Promise<boolean> {
return dag
.go()
.module(path)
.skipGenerate()
}testDirectories() 🔗
Directories in this module containing Go test files.
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.GoDirectory {
return dag.
Go().
Module(path).
TestDirectories()
}@function
def example(path: str) -> List[dagger.GoDirectory]:
return (
dag.go()
.module(path)
.test_directories()
)@func()
example(path: string): GoDirectory[] {
return dag
.go()
.module(path)
.testDirectories()
}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()
}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()
}skipTest() 🔗
Whether this module or an ancestor contains the configured test skip 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).
SkipTest(ctx)
}@function
async def example(path: str) -> bool:
return await (
dag.go()
.module(path)
.skip_test()
)@func()
async example(path: string): Promise<boolean> {
return dag
.go()
.module(path)
.skipTest()
}hasGenerateDirectives() 🔗
Whether this module’s Go files contain a go:generate directive.
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).
HasGenerateDirectives(ctx)
}@function
async def example(path: str) -> bool:
return await (
dag.go()
.module(path)
.has_generate_directives()
)@func()
async example(path: string): Promise<boolean> {
return dag
.go()
.module(path)
.hasGenerateDirectives()
}include() 🔗
Final workspace include patterns used to build this module’s source directory. With no include flags, defaults to test inputs.
Return Type
[String ! ] !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| ws | Workspace | - | No description provided |
| lint | Boolean | - | No description provided |
| test | Boolean | - | No description provided |
| generate | Boolean | - | 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()
}source() 🔗
Workspace source mounted for this module’s Go commands. With no include flags, defaults to test inputs.
Return Type
Directory !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| ws | Workspace | - | No description provided |
| lint | Boolean | - | No description provided |
| test | Boolean | - | No description provided |
| generate | Boolean | - | 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()
}test() 🔗
Run tests in this module. If the test skip marker is present, no tests are run.
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()
}includeDiscovered() 🔗
Additional workspace include patterns discovered by scanning Go directives and local go.mod replaces reachable from this module’s include graph. With no include flags, defaults to test inputs.
Return Type
[String ! ] !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| ws | Workspace | - | No description provided |
| lint | Boolean | - | No description provided |
| test | Boolean | - | No description provided |
| generate | Boolean | - | 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).
IncludeDiscovered(ctx)
}@function
async def example(path: str) -> List[str]:
return await (
dag.go()
.module(path)
.include_discovered()
)@func()
async example(path: string): Promise<string[]> {
return dag
.go()
.module(path)
.includeDiscovered()
}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()
}lint() 🔗
Run golangci-lint in this module. If the lint skip marker is present, no lint check is run.
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).
Lint(ctx)
}@function
async def example(path: str) -> None:
return await (
dag.go()
.module(path)
.lint()
)@func()
async example(path: string): Promise<void> {
return dag
.go()
.module(path)
.lint()
}generate() 🔗
Changes made by running go generate in this module. If the generate skip marker is present or no go:generate directives are found, the changeset is empty.
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(path string) *dagger.Changeset {
return dag.
Go().
Module(path).
Generate()
}@function
def example(path: str) -> dagger.Changeset:
return (
dag.go()
.module(path)
.generate()
)@func()
example(path: string): Changeset {
return dag
.go()
.module(path)
.generate()
}skipLint() 🔗
Whether this module or an ancestor contains the configured lint skip 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).
SkipLint(ctx)
}@function
async def example(path: str) -> bool:
return await (
dag.go()
.module(path)
.skip_lint()
)@func()
async example(path: string): Promise<boolean> {
return dag
.go()
.module(path)
.skipLint()
}Go 🔗
A Dagger module for Go - a programming language for building simple, secure, scalable systems. https://dagger.io https://golang.org
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@8255884bcfc1937a3a2f639f989e784428c0c1e4 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()
}skipLintFilename() 🔗
Marker filename that skips lint checks when found at or above a Go module root.
Return Type
String ! Example
dagger -m github.com/dagger/go@8255884bcfc1937a3a2f639f989e784428c0c1e4 call \
skip-lint-filenamefunc (m *MyModule) Example(ctx context.Context) string {
return dag.
Go().
SkipLintFilename(ctx)
}@function
async def example() -> str:
return await (
dag.go()
.skip_lint_filename()
)@func()
async example(): Promise<string> {
return dag
.go()
.skipLintFilename()
}version() 🔗
Go version used for test and generate commands.
Return Type
String ! Example
dagger -m github.com/dagger/go@8255884bcfc1937a3a2f639f989e784428c0c1e4 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()
}skipTestFilename() 🔗
Marker filename that skips tests when found at or above a Go module root.
Return Type
String ! Example
dagger -m github.com/dagger/go@8255884bcfc1937a3a2f639f989e784428c0c1e4 call \
skip-test-filenamefunc (m *MyModule) Example(ctx context.Context) string {
return dag.
Go().
SkipTestFilename(ctx)
}@function
async def example() -> str:
return await (
dag.go()
.skip_test_filename()
)@func()
async example(): Promise<string> {
return dag
.go()
.skipTestFilename()
}skipGenerateFilename() 🔗
Marker filename that skips go generate when found at or above a Go module root.
Return Type
String ! Example
dagger -m github.com/dagger/go@8255884bcfc1937a3a2f639f989e784428c0c1e4 call \
skip-generate-filenamefunc (m *MyModule) Example(ctx context.Context) string {
return dag.
Go().
SkipGenerateFilename(ctx)
}@function
async def example() -> str:
return await (
dag.go()
.skip_generate_filename()
)@func()
async example(): Promise<string> {
return dag
.go()
.skipGenerateFilename()
}modules() 🔗
Return every Go module discovered from workspace go.mod files. Optional include/exclude patterns filter discovered module root directories.
Return Type
[Module ! ] !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| ws | Workspace | - | No description provided |
| include | [String ! ] | - | No description provided |
| exclude | [String ! ] | - | No description provided |
| includeSkipLint | Boolean | - | No description provided |
| includeSkipTest | Boolean | - | No description provided |
| includeSkipGenerate | Boolean | - | 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)
}lintAll() 🔗
Run golangci-lint in every discovered Go module. Modules with the lint skip 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().
LintAll(ctx)
}@function
async def example() -> None:
return await (
dag.go()
.lint_all()
)@func()
async example(): Promise<void> {
return dag
.go()
.lintAll()
}generateAll() 🔗
Run go generate in every discovered Go module. Modules with the generate skip marker, or without go:generate directives, 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().
GenerateAll()
}@function
def example() -> dagger.Changeset:
return (
dag.go()
.generate_all()
)@func()
example(): Changeset {
return dag
.go()
.generateAll()
}testAll() 🔗
Run tests in every discovered Go module. Modules with the test skip 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()
}