addGoApp

Method
📦 Aspire.Hosting.Go v17.0.0
interface IDistributedApplicationBuilder {
// ... omitted for brevity
addGoApp(
name: string,
appDirectory: string,
packagePath?: string,
buildTags?: string[],
ldFlags?: string,
gcFlags?: string,
raceDetector?: boolean): 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,
packagePath?: string,
buildTags?: string[],
ldFlags?: string,
gcFlags?: string,
raceDetector?: boolean): 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`.
packagePathstringoptional= .The 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.
buildTagsstring[]optionalOptional build tags passed to the compiler via `-tags` (e.g. `"netgo"`, `"integration"`).
ldFlagsstringoptionalOptional linker flags passed via `-ldflags` (e.g. `"-X main.version=1.0.0"`).
gcFlagsstringoptionalOptional compiler flags passed via `-gcflags` (e.g. `"all=-N -l"` to disable optimisations for Delve).
raceDetectorbooleanoptional= FalseWhen `true`, enables the Go race detector by passing `-race` to `go run`.
GoAppResource

Applies to

This method applies to the following types: