Aspirerelease/17.0
Watch Aspire live streamsDocsTry Aspire

GoAppResource

Handle
📦 Aspire.Hosting.Go v17.0.0

Represents a Go application resource in the distributed application model.

type GoAppResource interface {
IComputeResource
IContainerFilesDestinationResource
Resource
ResourceWithArgs
ResourceWithEndpoints
ResourceWithEnvironment
ResourceWithWaitSupport
}

Properties

propertyResourceTypeDisplayNamestringget
Gets the ResourceTypeDisplayName property
ResourceTypeDisplayName() (string, error)

Methods

methodWithAppArgsbuilder
Passes extra arguments to the Go program at runtime. In normal run mode they appear after go run .; in Delve mode after the -- separator.
WithAppArgs(args []any) GoAppResource
args[]anyThe program arguments (e.g., "serve", "--config", "prod.yaml").
GoAppResource

The resource builder.

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

methodWithDelveServerbuilder
Starts a configurable headless Delve debug server so that DAP-compatible clients can attach remotely. The application is launched with dlv debug instead of go run. Delve must be available on the PATH.
WithDelveServer(options ...*DelveServerOptions) GoAppResource
options...*DelveServerOptionsOptional settings, described under Options.

Optional parameters are passed as the existing *DelveServerOptions struct.

GoAppResource

The resource builder.

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

methodWithGoPrivatebuilder
Configures private Go module authentication for publish-time Dockerfile generation.
WithGoPrivate(
privatePatterns []string,
authHost string,
options ...*WithGoPrivateOptions,
) GoAppResource
privatePatterns[]stringOne or more module path patterns that should bypass the public proxy and checksum database, e.g. "*.mycompany.com" or "github.com/myorg". Passed verbatim to GOPRIVATE, which implicitly covers GONOSUMCHECK and GONOPROXY.
authHoststringThe Git host that requires authentication, e.g. "github.com".
options...*WithGoPrivateOptionsOptional settings, described under Options.

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

UsernameArgName*stringThe Docker build-arg name for the Git username. Defaults to "GIT_USER". Pass it at build time with --build-arg GIT_USER=myuser.
TokenSecretId*stringThe BuildKit secret ID for the Git access token. Defaults to "gittoken". Pass it at build time with --secret id=gittoken,src=/path/to/token.
GoAppResource

The resource builder.

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

methodWithModDownloadbuilder
Runs go mod download before starting the application, pre-fetching all module dependencies into the local module cache without modifying go.sum. The main application waits for the download step to complete successfully before launching.
WithModDownload() GoAppResource
GoAppResource

The resource builder.

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

methodWithModTidybuilder
Runs go mod tidy before starting the application, ensuring go.sum is up to date. The main application waits for the tidy step to complete successfully before launching.
WithModTidy() GoAppResource
GoAppResource

The resource builder.

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

methodWithModVendorbuilder
Runs go mod vendor before starting the application, caching all module dependencies in the local vendor/ directory. The main application waits for the vendor step to complete successfully before launching.
WithModVendor() GoAppResource
GoAppResource

The resource builder.

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

methodWithVetToolbuilder
Runs go vet ./... before starting the application to catch static analysis issues. The main application waits for the vet step to complete successfully before launching.
WithVetTool() GoAppResource
GoAppResource

The resource builder.

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