Get started with the Go integration
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
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.
Why use Go with Aspire
Section titled “Why use Go with Aspire”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 .orgo run ./cmd/serverinstead 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.
How the pieces fit together
Section titled “How the pieces fit together”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
-
Set up Go apps in the AppHost
Section titled “Set up Go apps in the AppHost”Add the
Aspire.Hosting.Gohosting integration to your AppHost, then useAddGoApp/addGoAppto 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
-
Optionally try the Go AppHost templates
Section titled “Optionally try the Go AppHost templates”The
Aspire.Hosting.Gointegration 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 theAspire.Hosting.Gopackage.Try the experimental Go templates