Aspirerelease/17.0
Watch Aspire live streamsDocsTry Aspire

AddGoApp

Method
📦 Aspire.Hosting.Go v17.0.0
func (DistributedApplicationBuilder) AddGoApp(
name string,
appDirectory string,
options ...*AddGoAppOptions,
) GoAppResource

Signature

methodAddGoAppbuilder
Adds a Go application to the application model. The Go toolchain must be available on the PATH.
AddGoApp(
name string,
appDirectory string,
options ...*AddGoAppOptions,
) GoAppResource
namestringThe name of the resource.
appDirectorystringThe path to the directory that acts as both the Go module root (where go.mod lives) and the Docker build context for aspire publish.
options...*AddGoAppOptionsOptional settings, described under Options.

Optional parameters are passed in a trailing options ...*AddGoAppOptions argument.

PackagePath*stringThe Go package to run or build, relative to appDirectory. Defaults to "." (the module root itself). Use a sub-path such as "./cmd/server" when the main package is not at the module root (e.g. api/cmd/server/main.go with api/go.mod). This value is passed to go run, dlv debug, and go build consistently.
BuildTags[]stringOptional build tags passed to the compiler via -tags (e.g. "netgo", "integration").
LdFlags*stringOptional linker flags passed via -ldflags (e.g. "-X main.version=1.0.0").
GcFlags*stringOptional compiler flags passed via -gcflags (e.g. "all=-N -l" to disable optimisations for Delve).
RaceDetector*boolWhen true, enables the Go race detector by passing -race to go run.
GoAppResource

The resource builder.

Returns a handle; failures surface later via Err().

Applies to

This method applies to the following types:

typeDistributedApplicationBuilder