GoAppResource
Class net8.0
Represents a Go application resource in the distributed application model.
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{ // ...} ExecutableResourceIContainerFilesDestinationResourceIResourceIResourceWithEndpointsIResourceWithServiceDiscovery
Remarks
Section titled RemarksThis 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.
Constructors1
Section titled ConstructorsExamples
Section titled ExamplesAdd a Go web application to the distributed application model:
var builder = DistributedApplication.CreateBuilder(args);
var api = builder.AddGoApp("api", "../go-api") .WithHttpEndpoint(port: 8080);
builder.Build().Run();