go
No long description provided.
Installation
dagger install github.com/aluzzardi/dagger/modules/go@aec13cdf85e7cc7aa5a933e3c73a2604f6e73b01
Entrypoint
Return Type
Go !
Arguments
Name | Type | Description |
---|---|---|
source | Directory ! | Project source directory |
version | String | 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 |
Example
dagger -m github.com/aluzzardi/dagger/modules/go@aec13cdf85e7cc7aa5a933e3c73a2604f6e73b01 call \
--source DIR_PATH
func (m *myModule) example(source *Directory) *Go {
return dag.
Go(source)
}
@function
def example(source: dagger.Directory, ) -> dag.Go:
return (
dag.go(source)
)
@func()
example(source: Directory, ): Go {
return dag
.go(source)
}
Types
Go 🔗
A Go project
version() 🔗
Go version
Return Type
String !
Example
dagger -m github.com/aluzzardi/dagger/modules/go@aec13cdf85e7cc7aa5a933e3c73a2604f6e73b01 call \
--source DIR_PATH version
func (m *myModule) example(ctx context.Context, source *Directory) string {
return dag.
Go(source).
Version(ctx)
}
@function
async def example(source: dagger.Directory, ) -> str:
return await (
dag.go(source)
.version()
)
@func()
async example(source: Directory, ): Promise<string> {
return dag
.go(source)
.version()
}
source() 🔗
Project source directory
Return Type
Directory !
Example
dagger -m github.com/aluzzardi/dagger/modules/go@aec13cdf85e7cc7aa5a933e3c73a2604f6e73b01 call \
--source DIR_PATH source
func (m *myModule) example(source *Directory) *Directory {
return dag.
Go(source).
Source()
}
@function
def example(source: dagger.Directory, ) -> dagger.Directory:
return (
dag.go(source)
.source()
)
@func()
example(source: Directory, ): Directory {
return dag
.go(source)
.source()
}
moduleCache() 🔗
Go module cache
Return Type
CacheVolume !
Example
dagger -m github.com/aluzzardi/dagger/modules/go@aec13cdf85e7cc7aa5a933e3c73a2604f6e73b01 call \
--source DIR_PATH module-cache
func (m *myModule) example(source *Directory) *CacheVolume {
return dag.
Go(source).
ModuleCache()
}
@function
def example(source: dagger.Directory, ) -> dagger.CacheVolume:
return (
dag.go(source)
.module_cache()
)
@func()
example(source: Directory, ): CacheVolume {
return dag
.go(source)
.moduleCache()
}
buildCache() 🔗
Go build cache
Return Type
CacheVolume !
Example
dagger -m github.com/aluzzardi/dagger/modules/go@aec13cdf85e7cc7aa5a933e3c73a2604f6e73b01 call \
--source DIR_PATH build-cache
func (m *myModule) example(source *Directory) *CacheVolume {
return dag.
Go(source).
BuildCache()
}
@function
def example(source: dagger.Directory, ) -> dagger.CacheVolume:
return (
dag.go(source)
.build_cache()
)
@func()
example(source: Directory, ): CacheVolume {
return dag
.go(source)
.buildCache()
}
base() 🔗
Base container from which to run all operations
Return Type
Container !
Example
dagger -m github.com/aluzzardi/dagger/modules/go@aec13cdf85e7cc7aa5a933e3c73a2604f6e73b01 call \
--source DIR_PATH base
func (m *myModule) example(source *Directory) *Container {
return dag.
Go(source).
Base()
}
@function
def example(source: dagger.Directory, ) -> dagger.Container:
return (
dag.go(source)
.base()
)
@func()
example(source: Directory, ): Container {
return dag
.go(source)
.base()
}
ldflags() 🔗
Pass arguments to ‘go build -ldflags”
Return Type
[String ! ] !
Example
dagger -m github.com/aluzzardi/dagger/modules/go@aec13cdf85e7cc7aa5a933e3c73a2604f6e73b01 call \
--source DIR_PATH ldflags
func (m *myModule) example(ctx context.Context, source *Directory) []string {
return dag.
Go(source).
Ldflags(ctx)
}
@function
async def example(source: dagger.Directory, ) -> List[str]:
return await (
dag.go(source)
.ldflags()
)
@func()
async example(source: Directory, ): Promise<string[]> {
return dag
.go(source)
.ldflags()
}
values() 🔗
Add string value definition of the form importpath.name=value
Return Type
[String ! ] !
Example
dagger -m github.com/aluzzardi/dagger/modules/go@aec13cdf85e7cc7aa5a933e3c73a2604f6e73b01 call \
--source DIR_PATH values
func (m *myModule) example(ctx context.Context, source *Directory) []string {
return dag.
Go(source).
Values(ctx)
}
@function
async def example(source: dagger.Directory, ) -> List[str]:
return await (
dag.go(source)
.values()
)
@func()
async example(source: Directory, ): Promise<string[]> {
return dag
.go(source)
.values()
}
cgo() 🔗
Enable CGO
Return Type
Boolean !
Example
dagger -m github.com/aluzzardi/dagger/modules/go@aec13cdf85e7cc7aa5a933e3c73a2604f6e73b01 call \
--source DIR_PATH cgo
func (m *myModule) example(ctx context.Context, source *Directory) bool {
return dag.
Go(source).
Cgo(ctx)
}
@function
async def example(source: dagger.Directory, ) -> bool:
return await (
dag.go(source)
.cgo()
)
@func()
async example(source: Directory, ): Promise<boolean> {
return dag
.go(source)
.cgo()
}
race() 🔗
Enable race detector
Return Type
Boolean !
Example
dagger -m github.com/aluzzardi/dagger/modules/go@aec13cdf85e7cc7aa5a933e3c73a2604f6e73b01 call \
--source DIR_PATH race
func (m *myModule) example(ctx context.Context, source *Directory) bool {
return dag.
Go(source).
Race(ctx)
}
@function
async def example(source: dagger.Directory, ) -> bool:
return await (
dag.go(source)
.race()
)
@func()
async example(source: Directory, ): Promise<boolean> {
return dag
.go(source)
.race()
}
download() 🔗
Download dependencies into the module cache
Return Type
Go !
Example
dagger -m github.com/aluzzardi/dagger/modules/go@aec13cdf85e7cc7aa5a933e3c73a2604f6e73b01 call \
--source DIR_PATH download
func (m *myModule) example(source *Directory) *Go {
return dag.
Go(source).
Download()
}
@function
def example(source: dagger.Directory, ) -> dag.Go:
return (
dag.go(source)
.download()
)
@func()
example(source: Directory, ): Go {
return dag
.go(source)
.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/aluzzardi/dagger/modules/go@aec13cdf85e7cc7aa5a933e3c73a2604f6e73b01 call \
--source DIR_PATH env
func (m *myModule) example(source *Directory) *Container {
return dag.
Go(source).
Env()
}
@function
def example(source: dagger.Directory, ) -> dagger.Container:
return (
dag.go(source)
.env()
)
@func()
example(source: Directory, ): Container {
return dag
.go(source)
.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/aluzzardi/dagger/modules/go@aec13cdf85e7cc7aa5a933e3c73a2604f6e73b01 call \
--source DIR_PATH tests
func (m *myModule) example(ctx context.Context, source *Directory) string {
return dag.
Go(source).
Tests(ctx)
}
@function
async def example(source: dagger.Directory, ) -> str:
return await (
dag.go(source)
.tests()
)
@func()
async example(source: Directory, ): Promise<string> {
return dag
.go(source)
.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/aluzzardi/dagger/modules/go@aec13cdf85e7cc7aa5a933e3c73a2604f6e73b01 call \
--source DIR_PATH build
func (m *myModule) example(source *Directory) *Directory {
return dag.
Go(source).
Build()
}
@function
def example(source: dagger.Directory, ) -> dagger.Directory:
return (
dag.go(source)
.build()
)
@func()
example(source: Directory, ): Directory {
return dag
.go(source)
.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/aluzzardi/dagger/modules/go@aec13cdf85e7cc7aa5a933e3c73a2604f6e73b01 call \
--source DIR_PATH binary --pkg string
func (m *myModule) example(source *Directory, pkg string) *File {
return dag.
Go(source).
Binary(pkg)
}
@function
def example(source: dagger.Directory, pkg: str) -> dagger.File:
return (
dag.go(source)
.binary(pkg)
)
@func()
example(source: Directory, pkg: string): File {
return dag
.go(source)
.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/aluzzardi/dagger/modules/go@aec13cdf85e7cc7aa5a933e3c73a2604f6e73b01 call \
--source DIR_PATH test
func (m *myModule) example(ctx context.Context, source *Directory) {
return dag.
Go(source).
Test(ctx)
}
@function
async def example(source: dagger.Directory, ) -> None:
return await (
dag.go(source)
.test()
)
@func()
async example(source: Directory, ): Promise<void> {
return dag
.go(source)
.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/aluzzardi/dagger/modules/go@aec13cdf85e7cc7aa5a933e3c73a2604f6e73b01 call \
--source DIR_PATH list-packages
func (m *myModule) example(ctx context.Context, source *Directory) []string {
return dag.
Go(source).
ListPackages(ctx)
}
@function
async def example(source: dagger.Directory, ) -> List[str]:
return await (
dag.go(source)
.list_packages()
)
@func()
async example(source: Directory, ): Promise<string[]> {
return dag
.go(source)
.listPackages()
}
lint() 🔗
Lint the project
Return Type
Void !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
packages | [String ! ] | - | No description provided |
Example
dagger -m github.com/aluzzardi/dagger/modules/go@aec13cdf85e7cc7aa5a933e3c73a2604f6e73b01 call \
--source DIR_PATH lint
func (m *myModule) example(ctx context.Context, source *Directory) {
return dag.
Go(source).
Lint(ctx)
}
@function
async def example(source: dagger.Directory, ) -> None:
return await (
dag.go(source)
.lint()
)
@func()
async example(source: Directory, ): Promise<void> {
return dag
.go(source)
.lint()
}