Overview
Go has been added as an experimental polyglot AppHost language in .NET Aspire, reaching parity with the existing TypeScript, Python, and Java AppHost implementations. The Aspire docs need to be updated to cover this new language option.
What changed
PR: microsoft/aspire#16038
New capabilities
- Go AppHost support: Users can now create Aspire AppHosts using Go, with full code generation for the Aspire SDK
- Fluent builder API: The generated Go SDK supports idiomatic method chaining with error accumulation:
if err := builder.AddRedis("cache", nil, nil).WithDataVolume(nil, nil).Err(); err != nil {
log.Fatalf("cache setup: %v", err)
}
- CLI scaffolding:
aspire init --language go generates a Go AppHost project with apphost.go, go.mod, and aspire.config.json
- SDK code generation:
aspire restore --apphost apphost.go generates the Go SDK in .modules/
- Feature flag: Go support is experimental and requires enabling via:
aspire config set features:experimentalPolyglot:go true --global
Documentation areas to cover
- Getting started with Go AppHosts — prerequisites (Go 1.26+), project setup, running
- Go SDK API patterns — fluent chaining with
.Err(), CreateBuilder, Build, Run
aspire.config.json — "language": "go" configuration
- Available integrations — all
Aspire.Hosting.* integrations are available via code generation
- Update the polyglot/multi-language overview page to include Go alongside TypeScript, Python, Java
Example Go AppHost
package main
import (
"log"
"apphost/modules/aspire"
)
func main() {
builder, err := aspire.CreateBuilder(nil)
if err != nil {
log.Fatalf("Failed to create builder: %v", err)
}
cache := builder.AddRedis("cache", nil, nil).WithDataVolume(nil, nil)
if cache.Err() != nil {
log.Fatalf("Failed to add Redis: %v", cache.Err())
}
app, err := builder.Build()
if err != nil {
log.Fatalf("Build: %v", err)
}
if err := app.Run(nil); err != nil {
log.Fatalf("Run: %v", err)
}
}
Overview
Go has been added as an experimental polyglot AppHost language in .NET Aspire, reaching parity with the existing TypeScript, Python, and Java AppHost implementations. The Aspire docs need to be updated to cover this new language option.
What changed
PR: microsoft/aspire#16038
New capabilities
aspire init --language gogenerates a Go AppHost project withapphost.go,go.mod, andaspire.config.jsonaspire restore --apphost apphost.gogenerates the Go SDK in.modules/Documentation areas to cover
.Err(),CreateBuilder,Build,Runaspire.config.json—"language": "go"configurationAspire.Hosting.*integrations are available via code generationExample Go AppHost