microsoft / microsoft/aspire.dev

Document Go language support for polyglot AppHosts

Open
#700 1 comment 1 reaction 1 assignee View on GitHub

@IEvangelist is already working on this.

Since Jun 2, 2026.

Dominant language
MDX
Stars
193
Forks
87
Avg merge
1d 22h
Merged PRs (30d)
73

Description

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:
    db := builder.AddPostgres("db")
    if err := db.Err(); err != nil {
        log.Fatal(aspire.FormatError(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

  1. Getting started with Go AppHosts — prerequisites (Go 1.26+), project setup, running
  2. Go SDK API patterns — fluent chaining with .Err(), CreateBuilder, Build, Run
  3. aspire.config.json"language": "go" configuration
  4. Available integrations — all Aspire.Hosting.* integrations are available via code generation
  5. 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()
	if err != nil {
		log.Fatal(aspire.FormatError(err))
	}

	cache := builder.AddRedis("cache")
	db := builder.AddPostgres("db")
	if err := db.Err(); err != nil {
		log.Fatal(aspire.FormatError(err))
	}

	app, err := builder.Build()
	if err != nil {
		log.Fatal(aspire.FormatError(err))
	}
	if err := app.Run(); err != nil {
		log.Fatal(aspire.FormatError(err))
	}
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.