# GoAppResource

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

Represents a Go application resource in the distributed application model.

## Definition

```csharp
namespace Aspire.Hosting.Go;

public class GoAppResource
    : Aspire.Hosting.ApplicationModel.ExecutableResource,
      Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource,
      Aspire.Hosting.ApplicationModel.IResource,
      Aspire.Hosting.ApplicationModel.IResourceWithEndpoints,
      Aspire.Hosting.IResourceWithServiceDiscovery
{
    // ...
}
```

## ATS metadata

### ATS export

- Type ID: `Aspire.Hosting.Go/GoAppResource`

## Remarks

This resource allows Go applications to run as part of a distributed application. The resource manages the Go toolchain, working directory, and lifecycle of the Go application.

Go applications can expose HTTP endpoints, communicate with other services, and participate in service discovery like other Aspire resources. They support automatic OpenTelemetry instrumentation when configured with the appropriate Go packages.

## Constructors

- [GoAppResource(string, string)](/reference/api/csharp/aspire.hosting.go/goappresource/constructors.md#constructor-string-string) -- Represents a Go application resource in the distributed application model.

## Examples

Add a Go web application to the distributed application model:

```csharp
var builder = DistributedApplication.CreateBuilder(args);

var api = builder.AddGoApp("api", "../go-api")
    .WithHttpEndpoint(port: 8080);

builder.Build().Run();
```
