go
No long description provided.
Installation
dagger install github.com/shykes/x/go@b0966cb5dc12504fbf9060e26742e7c0e5f843c0
Entrypoint
Return Type
Go !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
source | Directory | - | Project source directory |
version | String | "1.24.3" | Go version |
moduleCache | CacheVolume | - | Use a custom module cache |
buildCache | CacheVolume | - | Use a custom build cache |
base | Container | - | Use a custom base container. The container must have Go installed. |
ldflags | [String ! ] | - | Pass arguments to 'go build -ldflags'' |
values | [String ! ] | - | Add string value definition of the form importpath.name=value Example: "github.com/my/module.Foo=bar" |
cgo | Boolean | - | Enable CGO |
race | Boolean | - | Enable race detector. Implies cgo=true |
experiment | [String ! ] | - | Enable go experiments https://pkg.go.dev/internal/goexperiment |
Example
dagger -m github.com/shykes/x/go@b0966cb5dc12504fbf9060e26742e7c0e5f843c0 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 🔗
A Go project
version() 🔗
Go version
Return Type
String !
Example
dagger -m github.com/shykes/x/go@b0966cb5dc12504fbf9060e26742e7c0e5f843c0 call \
version
func (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()
}
source() 🔗
Project source directory
Return Type
Directory !
Example
dagger -m github.com/shykes/x/go@b0966cb5dc12504fbf9060e26742e7c0e5f843c0 call \
source
func (m *MyModule) Example() *dagger.Directory {
return dag.
Go().
Source()
}
@function
def example() -> dagger.Directory:
return (
dag.go()
.source()
)
@func()
example(): Directory {
return dag
.go()
.source()
}
moduleCache() 🔗
Go module cache
Return Type
CacheVolume !
Example
dagger -m github.com/shykes/x/go@b0966cb5dc12504fbf9060e26742e7c0e5f843c0 call \
module-cache
func (m *MyModule) Example() *dagger.CacheVolume {
return dag.
Go().
ModuleCache()
}
@function
def example() -> dagger.CacheVolume:
return (
dag.go()
.module_cache()
)
@func()
example(): CacheVolume {
return dag
.go()
.moduleCache()
}
buildCache() 🔗
Go build cache
Return Type
CacheVolume !
Example
dagger -m github.com/shykes/x/go@b0966cb5dc12504fbf9060e26742e7c0e5f843c0 call \
build-cache
func (m *MyModule) Example() *dagger.CacheVolume {
return dag.
Go().
BuildCache()
}
@function
def example() -> dagger.CacheVolume:
return (
dag.go()
.build_cache()
)
@func()
example(): CacheVolume {
return dag
.go()
.buildCache()
}
base() 🔗
Base container from which to run all operations
Return Type
Container !
Example
dagger -m github.com/shykes/x/go@b0966cb5dc12504fbf9060e26742e7c0e5f843c0 call \
base
func (m *MyModule) Example() *dagger.Container {
return dag.
Go().
Base()
}
@function
def example() -> dagger.Container:
return (
dag.go()
.base()
)
@func()
example(): Container {
return dag
.go()
.base()
}
ldflags() 🔗
Pass arguments to ‘go build -ldflags”
Return Type
[String ! ] !
Example
dagger -m github.com/shykes/x/go@b0966cb5dc12504fbf9060e26742e7c0e5f843c0 call \
ldflags
func (m *MyModule) Example(ctx context.Context) []string {
return dag.
Go().
Ldflags(ctx)
}
@function
async def example() -> List[str]:
return await (
dag.go()
.ldflags()
)
@func()
async example(): Promise<string[]> {
return dag
.go()
.ldflags()
}
values() 🔗
Add string value definition of the form importpath.name=value
Return Type
[String ! ] !
Example
dagger -m github.com/shykes/x/go@b0966cb5dc12504fbf9060e26742e7c0e5f843c0 call \
values
func (m *MyModule) Example(ctx context.Context) []string {
return dag.
Go().
Values(ctx)
}
@function
async def example() -> List[str]:
return await (
dag.go()
.values()
)
@func()
async example(): Promise<string[]> {
return dag
.go()
.values()
}
cgo() 🔗
Enable CGO
Return Type
Boolean !
Example
dagger -m github.com/shykes/x/go@b0966cb5dc12504fbf9060e26742e7c0e5f843c0 call \
cgo
func (m *MyModule) Example(ctx context.Context) bool {
return dag.
Go().
Cgo(ctx)
}
@function
async def example() -> bool:
return await (
dag.go()
.cgo()
)
@func()
async example(): Promise<boolean> {
return dag
.go()
.cgo()
}
race() 🔗
Enable race detector
Return Type
Boolean !
Example
dagger -m github.com/shykes/x/go@b0966cb5dc12504fbf9060e26742e7c0e5f843c0 call \
race
func (m *MyModule) Example(ctx context.Context) bool {
return dag.
Go().
Race(ctx)
}
@function
async def example() -> bool:
return await (
dag.go()
.race()
)
@func()
async example(): Promise<boolean> {
return dag
.go()
.race()
}
experiment() 🔗
Enable go experiments
Return Type
[String ! ] !
Example
dagger -m github.com/shykes/x/go@b0966cb5dc12504fbf9060e26742e7c0e5f843c0 call \
experiment
func (m *MyModule) Example(ctx context.Context) []string {
return dag.
Go().
Experiment(ctx)
}
@function
async def example() -> List[str]:
return await (
dag.go()
.experiment()
)
@func()
async example(): Promise<string[]> {
return dag
.go()
.experiment()
}
download() 🔗
Download dependencies into the module cache
Return Type
Go !
Example
dagger -m github.com/shykes/x/go@b0966cb5dc12504fbf9060e26742e7c0e5f843c0 call \
download
func (m *MyModule) Example() *dagger.Go {
return dag.
Go().
Download()
}
@function
def example() -> dagger.Go:
return (
dag.go()
.download()
)
@func()
example(): Go {
return dag
.go()
.download()
}
env() 🔗
Prepare a build environment for the given Go source code: - Build a base container with Go tooling installed and configured - Apply configuration - Mount the source code
Return Type
Container !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
platform | Scalar | - | No description provided |
Example
dagger -m github.com/shykes/x/go@b0966cb5dc12504fbf9060e26742e7c0e5f843c0 call \
env
func (m *MyModule) Example() *dagger.Container {
return dag.
Go().
Env()
}
@function
def example() -> dagger.Container:
return (
dag.go()
.env()
)
@func()
example(): Container {
return dag
.go()
.env()
}
tests() 🔗
List tests
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
pkgs | [String ! ] | ["./..."] | Packages to list tests from (default all packages) |
Example
dagger -m github.com/shykes/x/go@b0966cb5dc12504fbf9060e26742e7c0e5f843c0 call \
tests
func (m *MyModule) Example(ctx context.Context) string {
return dag.
Go().
Tests(ctx)
}
@function
async def example() -> str:
return await (
dag.go()
.tests()
)
@func()
async example(): Promise<string> {
return dag
.go()
.tests()
}
build() 🔗
Build the given main packages, and return the build directory
Return Type
Directory !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
pkgs | [String ! ] | ["./..."] | Which targets to build (default all main packages) |
noSymbols | Boolean | - | Disable symbol table |
noDwarf | Boolean | - | Disable DWARF generation |
platform | Scalar | - | Target build platform |
output | String | "./bin/" | Output directory |
Example
dagger -m github.com/shykes/x/go@b0966cb5dc12504fbf9060e26742e7c0e5f843c0 call \
build
func (m *MyModule) Example() *dagger.Directory {
return dag.
Go().
Build()
}
@function
def example() -> dagger.Directory:
return (
dag.go()
.build()
)
@func()
example(): Directory {
return dag
.go()
.build()
}
binary() 🔗
Build a single main package, and return the compiled binary
Return Type
File !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
pkg | String ! | - | Which package to build |
noSymbols | Boolean | - | Disable symbol table |
noDwarf | Boolean | - | Disable DWARF generation |
platform | Scalar | - | Target build platform |
Example
dagger -m github.com/shykes/x/go@b0966cb5dc12504fbf9060e26742e7c0e5f843c0 call \
binary --pkg string
func (m *MyModule) Example(pkg string) *dagger.File {
return dag.
Go().
Binary(pkg)
}
@function
def example(pkg: str) -> dagger.File:
return (
dag.go()
.binary(pkg)
)
@func()
example(pkg: string): File {
return dag
.go()
.binary(pkg)
}
test() 🔗
Run tests for the given packages
Return Type
Void !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
run | String | - | Only run these tests |
skip | String | - | Skip these tests |
failfast | Boolean | - | Abort test run on first failure |
parallel | Integer | 0 | How many tests to run in parallel - defaults to the number of CPUs |
timeout | String | "30m" | How long before timing out the test run |
count | Integer | 1 | No description provided |
pkgs | [String ! ] | ["./..."] | Which packages to test |
Example
dagger -m github.com/shykes/x/go@b0966cb5dc12504fbf9060e26742e7c0e5f843c0 call \
test
func (m *MyModule) Example(ctx context.Context) {
return dag.
Go().
Test(ctx)
}
@function
async def example() -> None:
return await (
dag.go()
.test()
)
@func()
async example(): Promise<void> {
return dag
.go()
.test()
}
listPackages() 🔗
List packages matching the specified criteria
Return Type
[String ! ] !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
pkgs | [String ! ] | ["./..."] | Filter by name or pattern. Example './foo/...' |
onlyMain | Boolean | - | Only list main packages |
Example
dagger -m github.com/shykes/x/go@b0966cb5dc12504fbf9060e26742e7c0e5f843c0 call \
list-packages
func (m *MyModule) Example(ctx context.Context) []string {
return dag.
Go().
ListPackages(ctx)
}
@function
async def example() -> List[str]:
return await (
dag.go()
.list_packages()
)
@func()
async example(): Promise<string[]> {
return dag
.go()
.listPackages()
}
lint() 🔗
Lint the project
Return Type
Void !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
packages | [String ! ] | - | No description provided |
Example
dagger -m github.com/shykes/x/go@b0966cb5dc12504fbf9060e26742e7c0e5f843c0 call \
lint
func (m *MyModule) Example(ctx context.Context) {
return dag.
Go().
Lint(ctx)
}
@function
async def example() -> None:
return await (
dag.go()
.lint()
)
@func()
async example(): Promise<void> {
return dag
.go()
.lint()
}