golang
A utility module for building, testing, and linting Go projectsInstallation
dagger install github.com/kpenfound/dagger-modules/golang@v0.2.0Entrypoint
Return Type
Golang !Arguments
| Name | Type | Default Value | Description | 
|---|---|---|---|
| ctr | Container | - | No description provided | 
| proj | Directory | - | No description provided | 
Example
dagger -m github.com/kpenfound/dagger-modules/golang@a22ea31658571ece79016162ecedabb7f7defe6a call \
func (m *MyModule) Example() *dagger.Golang  {
	return dag.
			Golang()
}@function
def example() -> dagger.Golang:
	return (
		dag.golang()
	)@func()
example(): Golang {
	return dag
		.golang()
}Types
Golang 🔗
build() 🔗
Build the Go project
Return Type
Directory !Arguments
| Name | Type | Default Value | Description | 
|---|---|---|---|
| source | Directory | - | The Go source code to build | 
| args | [String ! ] ! | - | Arguments to `go build` | 
| arch | String | - | The architecture for GOARCH | 
| os | String | - | The operating system for GOOS | 
Example
dagger -m github.com/kpenfound/dagger-modules/golang@a22ea31658571ece79016162ecedabb7f7defe6a call \
 build --args string1 --args string2func (m *MyModule) Example(args []string) *dagger.Directory  {
	return dag.
			Golang().
			Build(args)
}@function
def example(args: List[str]) -> dagger.Directory:
	return (
		dag.golang()
		.build(args)
	)@func()
example(args: string[]): Directory {
	return dag
		.golang()
		.build(args)
}buildContainer() 🔗
Build a Go project returning a Container containing the build
Return Type
Container !Arguments
| Name | Type | Default Value | Description | 
|---|---|---|---|
| source | Directory | - | The Go source code to build | 
| args | [String ! ] | - | Arguments to `go build` | 
| arch | String | - | The architecture for GOARCH | 
| os | String | - | The operating system for GOOS | 
| base | Container | - | Base container in which to copy the build | 
Example
dagger -m github.com/kpenfound/dagger-modules/golang@a22ea31658571ece79016162ecedabb7f7defe6a call \
 build-containerfunc (m *MyModule) Example() *dagger.Container  {
	return dag.
			Golang().
			BuildContainer()
}@function
def example() -> dagger.Container:
	return (
		dag.golang()
		.build_container()
	)@func()
example(): Container {
	return dag
		.golang()
		.buildContainer()
}test() 🔗
Test the Go project
Return Type
String !Arguments
| Name | Type | Default Value | Description | 
|---|---|---|---|
| source | Directory | - | The Go source code to test | 
| args | [String ! ] | - | Arguments to `go test` +default "./..." | 
Example
dagger -m github.com/kpenfound/dagger-modules/golang@a22ea31658571ece79016162ecedabb7f7defe6a call \
 testfunc (m *MyModule) Example(ctx context.Context) string  {
	return dag.
			Golang().
			Test(ctx)
}@function
async def example() -> str:
	return await (
		dag.golang()
		.test()
	)@func()
async example(): Promise<string> {
	return dag
		.golang()
		.test()
}golangciLint() 🔗
Lint the Go project
Return Type
String !Arguments
| Name | Type | Default Value | Description | 
|---|---|---|---|
| source | Directory | - | The Go source code to lint | 
Example
dagger -m github.com/kpenfound/dagger-modules/golang@a22ea31658571ece79016162ecedabb7f7defe6a call \
 golangci-lintfunc (m *MyModule) Example(ctx context.Context) string  {
	return dag.
			Golang().
			GolangciLint(ctx)
}@function
async def example() -> str:
	return await (
		dag.golang()
		.golangci_lint()
	)@func()
async example(): Promise<string> {
	return dag
		.golang()
		.golangciLint()
}base() 🔗
Sets up the Container with a golang image and cache volumes
Return Type
Golang !Arguments
| Name | Type | Default Value | Description | 
|---|---|---|---|
| version | String ! | - | No description provided | 
Example
dagger -m github.com/kpenfound/dagger-modules/golang@a22ea31658571ece79016162ecedabb7f7defe6a call \
 base --version stringfunc (m *MyModule) Example(version string) *dagger.Golang  {
	return dag.
			Golang().
			Base(version)
}@function
def example(version: str) -> dagger.Golang:
	return (
		dag.golang()
		.base(version)
	)@func()
example(version: string): Golang {
	return dag
		.golang()
		.base(version)
}container() 🔗
The go build container
Return Type
Container !Example
dagger -m github.com/kpenfound/dagger-modules/golang@a22ea31658571ece79016162ecedabb7f7defe6a call \
 containerfunc (m *MyModule) Example() *dagger.Container  {
	return dag.
			Golang().
			Container()
}@function
def example() -> dagger.Container:
	return (
		dag.golang()
		.container()
	)@func()
example(): Container {
	return dag
		.golang()
		.container()
}project() 🔗
The go project directory
Return Type
Directory !Example
dagger -m github.com/kpenfound/dagger-modules/golang@a22ea31658571ece79016162ecedabb7f7defe6a call \
 projectfunc (m *MyModule) Example() *dagger.Directory  {
	return dag.
			Golang().
			Project()
}@function
def example() -> dagger.Directory:
	return (
		dag.golang()
		.project()
	)@func()
example(): Directory {
	return dag
		.golang()
		.project()
}withProject() 🔗
Specify the Project to use in the module
Return Type
Golang !Arguments
| Name | Type | Default Value | Description | 
|---|---|---|---|
| dir | Directory ! | - | No description provided | 
Example
dagger -m github.com/kpenfound/dagger-modules/golang@a22ea31658571ece79016162ecedabb7f7defe6a call \
 with-project --dir DIR_PATHfunc (m *MyModule) Example(dir *dagger.Directory) *dagger.Golang  {
	return dag.
			Golang().
			WithProject(dir)
}@function
def example(dir: dagger.Directory) -> dagger.Golang:
	return (
		dag.golang()
		.with_project(dir)
	)@func()
example(dir: Directory): Golang {
	return dag
		.golang()
		.withProject(dir)
}withContainer() 🔗
Bring your own container
Return Type
Golang !Arguments
| Name | Type | Default Value | Description | 
|---|---|---|---|
| ctr | Container ! | - | No description provided | 
Example
dagger -m github.com/kpenfound/dagger-modules/golang@a22ea31658571ece79016162ecedabb7f7defe6a call \
 with-container --ctr IMAGE:TAGfunc (m *MyModule) Example(ctr *dagger.Container) *dagger.Golang  {
	return dag.
			Golang().
			WithContainer(ctr)
}@function
def example(ctr: dagger.Container) -> dagger.Golang:
	return (
		dag.golang()
		.with_container(ctr)
	)@func()
example(ctr: Container): Golang {
	return dag
		.golang()
		.withContainer(ctr)
}buildRemote() 🔗
Build a remote git repo
Return Type
Directory !Arguments
| Name | Type | Default Value | Description | 
|---|---|---|---|
| remote | String ! | - | No description provided | 
| ref | String ! | - | No description provided | 
| module | String ! | - | No description provided | 
| arch | String | - | No description provided | 
| platform | String | - | No description provided | 
Example
dagger -m github.com/kpenfound/dagger-modules/golang@a22ea31658571ece79016162ecedabb7f7defe6a call \
 build-remote --remote string --ref string --module stringfunc (m *MyModule) Example(remote string, ref string, module string) *dagger.Directory  {
	return dag.
			Golang().
			BuildRemote(remote, ref, module)
}@function
def example(remote: str, ref: str, module: str) -> dagger.Directory:
	return (
		dag.golang()
		.build_remote(remote, ref, module)
	)@func()
example(remote: string, ref: string, module: string): Directory {
	return dag
		.golang()
		.buildRemote(remote, ref, module)
}