go
No long description provided.
Installation
dagger install github.com/dagger/go@5a77d9087efb6abbc272af2b2ed87db53b3da8adEntrypoint
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. |
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@5a77d9087efb6abbc272af2b2ed87db53b3da8ad 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
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()
}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()
}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()
}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()
}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()
}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()
}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()
}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()
}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()
}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()
}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()
}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()
}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()
}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()
}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()
}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()
}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@5a77d9087efb6abbc272af2b2ed87db53b3da8ad 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@5a77d9087efb6abbc272af2b2ed87db53b3da8ad 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()
}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@5a77d9087efb6abbc272af2b2ed87db53b3da8ad 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()
}version() 🔗
Go version used for test and generate commands.
Return Type
String ! Example
dagger -m github.com/dagger/go@5a77d9087efb6abbc272af2b2ed87db53b3da8ad 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()
}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@5a77d9087efb6abbc272af2b2ed87db53b3da8ad 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()
}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)
}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()
}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()
}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()
}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()
}