इसे छोड़कर कंटेंट पर जाएं
Docs Try Aspire
Docs Try

Get started with the Go integration

यह कंटेंट अभी तक आपकी भाषा में उपलब्ध नहीं है।

Go logo

The Aspire Go hosting integration lets you run Go applications alongside your other Aspire resources from the AppHost. Aspire runs Go apps with the local Go toolchain during development, wires them into the Aspire app model, supports service discovery and endpoint configuration, and can emit Dockerfile-based container build artifacts for deployment targets that need them.

Adding Go apps through Aspire gives you:

  • One app model for every service. Model Go applications, projects, containers, and backing services together in the AppHost.
  • Local development with the Go toolchain. Aspire runs Go apps with commands such as go run . or go run ./cmd/server instead of requiring a container for every edit-run loop.
  • Endpoint and environment wiring. Configure ports, environment variables, service discovery, and resource dependencies from the AppHost.
  • Dashboard visibility. Go app resources appear in the Aspire dashboard with logs, status, endpoints, and lifecycle controls.
  • Publish-time container artifacts. Deployment targets that need container build artifacts can use an existing Dockerfile or let Aspire generate one from the Go app resource.

The Go integration is a hosting integration. You install it in the AppHost, add one or more Go app resources, and configure how Aspire runs, debugs, and publishes each app.

architecture-beta

  group apphost(server)[AppHost]
  group goapp(server)[Go app]

  service hosting(server)[Go hosting integration] in apphost
  service resource(logos:go)[Go app resource] in apphost
  service toolchain(logos:go)[Go toolchain] in goapp
  service app(logos:go)[Go process] in goapp

  hosting:R --> L:resource
  resource:R --> L:toolchain
  toolchain:R --> L:app
  1. Add the Aspire.Hosting.Go hosting integration to your AppHost, then use AddGoApp / addGoApp to model a Go app resource. The host reference covers package installation, common Go layouts, app arguments, build options, Go module helper commands, Delve debugging, private modules, and publish behavior.

    Set up Go apps in the AppHost

  2. The Aspire.Hosting.Go integration works from C# and TypeScript AppHosts. Aspire also includes experimental Go AppHost and Go starter template support in the Aspire CLI. These templates use experimental Go AppHost APIs instead of the Aspire.Hosting.Go package.

    Try the experimental Go templates