# GoHostingExtensions

- Kind: `class`
- Package: [Aspire.Hosting.Go](/reference/api/csharp/aspire.hosting.go.md)
- Version: `13.4.0-preview.1.26281.18`
- Namespace: `Aspire.Hosting`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/becb48e2d61099e35ae336d527d3875e928d6594/src/Aspire.Hosting.Go/GoHostingExtensions.cs)

Provides extension methods for adding Go applications to an `Hosting.IDistributedApplicationBuilder`.

## Definition

```csharp
namespace Aspire.Hosting;

public static class GoHostingExtensions
{
    // ...
}
```

## Methods

- [AddGoApp(IDistributedApplicationBuilder, string, string, string, string[]?, string?, string?, bool)](/reference/api/csharp/aspire.hosting.go/gohostingextensions/methods.md#addgoapp-idistributedapplicationbuilder-string-string-string-string-string-string-bool) : `IResourceBuilder<GoAppResource>` `extension` `ats export` -- Adds a Go application to the application model. The Go toolchain must be available on the PATH.
- [WithAppArgs(IResourceBuilder<T>, object[])](/reference/api/csharp/aspire.hosting.go/gohostingextensions/methods.md#withappargs-iresourcebuilder-t-object) : `IResourceBuilder<T>` `extension` `ats export` -- 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)](/reference/api/csharp/aspire.hosting.go/gohostingextensions/methods.md#withdelveserver-iresourcebuilder-t-int) : `IResourceBuilder<T>` `extension` `ats export` -- 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)](/reference/api/csharp/aspire.hosting.go/gohostingextensions/methods.md#withgoprivate-iresourcebuilder-t-string-string-string-string) : `IResourceBuilder<T>` `extension` `ats export` -- Configures private Go module authentication for publish-time Dockerfile generation.
- [WithModDownload(IResourceBuilder<T>)](/reference/api/csharp/aspire.hosting.go/gohostingextensions/methods.md#withmoddownload-iresourcebuilder-t) : `IResourceBuilder<T>` `extension` `ats export` -- 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>)](/reference/api/csharp/aspire.hosting.go/gohostingextensions/methods.md#withmodtidy-iresourcebuilder-t) : `IResourceBuilder<T>` `extension` `ats export` -- 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>)](/reference/api/csharp/aspire.hosting.go/gohostingextensions/methods.md#withmodvendor-iresourcebuilder-t) : `IResourceBuilder<T>` `extension` `ats export` -- 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>)](/reference/api/csharp/aspire.hosting.go/gohostingextensions/methods.md#withvettool-iresourcebuilder-t) : `IResourceBuilder<T>` `extension` `ats export` -- 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.
