GoHostingExtensions
Class static net8.0
Provides extension methods for adding Go applications to an
Hosting.IDistributedApplicationBuilder. namespace Aspire.Hosting;
public static class GoHostingExtensions{ // ...} 8 members
Methods8
Section titled MethodsAddGoApp(IDistributedApplicationBuilder, string, string, string, string[]?, string?, string?, bool)extensionats exportIResourceBuilder<GoAppResource> Adds a Go application to the application model. The Go toolchain must be available on the PATH.
WithAppArgs(IResourceBuilder<T>, object[])extensionats exportIResourceBuilder<T> Passes extra arguments to the Go program at runtime. In normal run mode they appear after
go run .; in Delve mode after the -- separator. WithDelveServer(IResourceBuilder<T>, int)extensionats exportIResourceBuilder<T> Starts a headless Delve debug server so that any DAP-compatible client can attach remotely. The application is launched as
dlv --headless=true --listen=127.0.0.1:<port> --api-version=2 debug . instead of go run .. Delve must be available on the PATH. WithGoPrivate(IResourceBuilder<T>, string[], string, string, string)extensionats exportIResourceBuilder<T> Configures private Go module authentication for publish-time Dockerfile generation.
WithModDownload(IResourceBuilder<T>)extensionats exportIResourceBuilder<T> 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. WithModTidy(IResourceBuilder<T>)extensionats exportIResourceBuilder<T> 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. WithModVendor(IResourceBuilder<T>)extensionats exportIResourceBuilder<T> 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. WithVetTool(IResourceBuilder<T>)extensionats exportIResourceBuilder<T> 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.