Skip to content
Docs Try Aspire
Docs Try

GoHostingExtensions

Class static net8.0
📦 Aspire.Hosting.Go v13.4.0-preview.1.26281.18
Provides extension methods for adding Go applications to an Hosting.IDistributedApplicationBuilder.
namespace Aspire.Hosting;
public static class GoHostingExtensions
{
// ...
}
AddGoApp(IDistributedApplicationBuilder, string, string, string, string[]?, string?, string?, bool)extensionats export
IResourceBuilder<GoAppResource>
Adds a Go application to the application model. The Go toolchain must be available on the PATH.
WithAppArgs(IResourceBuilder<T>, object[])extensionats export
IResourceBuilder<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 export
IResourceBuilder<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 export
IResourceBuilder<T>
Configures private Go module authentication for publish-time Dockerfile generation.
WithModDownload(IResourceBuilder<T>)extensionats export
IResourceBuilder<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 export
IResourceBuilder<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 export
IResourceBuilder<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 export
IResourceBuilder<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.
View all methods