Skip to content

feat: Go polyglot AppHost — fixtures, playground, transport fixes, fluent API - #16038

Merged
Sébastien Ros (sebastienros) merged 41 commits into
microsoft:mainfrom
edmondshtogu:feat/go-polyglot
May 1, 2026
Merged

Sébastien Ros (sebastienros) merged 41 commits into
microsoft:mainfrom
edmondshtogu:feat/go-polyglot

Conversation

@edmondshtogu

@edmondshtogu edmondshtogu (edmondshtogu) commented Apr 10, 2026 •

Copy link
Copy Markdown
Contributor

Description

Completes the Go polyglot AppHost feature (#15813) to reach parity with the TypeScript AppHost implementation. The core code generator (AtsGoCodeGenerator.cs, GoLanguageSupport.cs) and CLI detection were already merged; this PR addresses the remaining gaps in the generator output, the runtime, the project template, and CI.

Changes

Generator (AtsGoCodeGenerator.cs, GoLanguageSupport.cs)

  • Capabilities that take optional configuration emit a single method with ...*XxxOptions variadic parameter.
  • Extended fluent emission from With* to Add* factory methods so the entire AddX().WithY().WithZ().Err() chain composes.
    • Idiomatic chaining now looks like:
      cache := builder.AddRedis("cache").
          WithDataVolume(&aspire.WithDataVolumeOptions{Name: aspire.StringPtr("redis-data")}).
          WithPersistence(&aspire.WithPersistenceOptions{Interval: aspire.Float64Ptr(60_000_000)})
      if err := cache.Err(); err != nil {
          log.Fatal(aspire.FormatError(err))
      }
  • Simplified the fluent-decision logic to isResourceBuilder + returnsSameType; removed the redundant _resourceBuilderTypeIds bookkeeping.
  • Resources now satisfy the Resource interface directly — WithReference, WaitFor, etc. accept builders without the old NewIResource(handle, client) shim.

Runtime (Resources/transport.go)

  • Replaced single ioMu with writeMu + a pending request-ID map; eliminates the callback-reentry deadlock.
  • Background readLoop demultiplexes responses to per-call channels; server-initiated callbacks run on their own goroutines.
  • drainPendingWithError() inside closeConnection() unblocks in-flight callers before any reconnect.
  • Reconnect-safe: c.reader removed; readLoop/closeConnection operate on the captured conn so a stale goroutine can't tear down a fresh connection.
  • New jsonRPCID() handles float64/int64/json.Number/numeric strings — no more panics on non-float64 IDs.
  • Exported aspire.FormatError(err) for consistent error rendering in user code.

Runtime (Resources/base.go)

  • resourceBuilderBase gained err + Err() error so fluent chains accumulate the first failure instead of returning (value, error) at every step.
  • Errored constructors (newErroredResourceBuilder, newErroredHandleWrapperBase) let the generator return a usable-but-failed builder when an upstream call fails.
  • Generic lazy List[T] / Dict[K,V] helpers expose capability-backed collections (Count, Get, Add, Set, Clear, ToArray).
  • RefExpr / ConditionalRefExpr build *ReferenceExpression values from format strings, mirroring the TS/Python expression builders.
  • Exported pointer helpers: StringPtr, IntPtr, BoolPtr, Float64Ptr for inline population of optional pointer fields.

CLI project template (src/Aspire.Cli/Templating/Templates/go-starter/)

  • New go-starter template — aspire new can now scaffold a Go AppHost end-to-end.
  • Includes apphost.go (Redis cache + HTTP api executable wired with WithReference / WaitFor / WithOtlpExporter), aspire.config.json, go.mod.
  • Bundled api/ service (main.go, telemetry.go, go.mod) preconfigured for OTLP export so it shows up in the dashboard out of the box.
  • .vscode/extensions.json recommends the Go extension.

Test fixtures (tests/PolyglotAppHosts/*/Go/)

  • Added compile-check fixtures for every existing integration variant, mirroring the TypeScript/Python/Java structure (apphost.go + aspire.config.json + go.mod).

CI / build scripts (.github/workflows/polyglot-validation/)

  • test-go.sh — replaced fragile sed -i multi-line insertion (BSD-sed incompatible on macOS) with portable awk injection; updated injected code to the fluent WithImageRegistry(...).Err() pattern.
  • New test-go-playground.sh mirrors the TypeScript/Python playground scripts: iterates every tests/PolyglotAppHosts/*/Go/, runs aspire restore --non-interactive --apphost apphost.go, verifies .modules/aspire.go was generated, and compile-checks with go build -buildvcs=false ./... (avoids VCS stamping failures in Docker/CI).
  • Dockerfile.golang — bundles test-go-playground.sh and runs both scripts from the entrypoint, matching the Python image layout.

Playground (playground/GoAppHost/)

  • New minimal interactive Go AppHost playground (apphost.go, go.mod, aspire.config.json, apphost.run.json) for manual aspire run smoke-testing behind the features:experimentalPolyglot:go flag.

Fixes #15813

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.

      The tests are passing locally, so quite confident.

    • No. Follow-up changes expected.and test PR cli locally with a project of mine.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No

      The transport.go refactor is covered structurally (no deadlock possible with the async model). The fixtures themselves serve as compile-check scenario tests via
      test-go-playground.sh. No new xUnit tests were added.

  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No

      All changes are in: Go source files embedded as resources (not .NET public API), CI scripts, test fixtures, and a playground. No new C# public API surfaces.

  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No

      The transport.go change uses the same Unix socket / named pipe communication channel; the async refactor doesn't change the trust boundary.

  • Does the change require an update in our Aspire docs?

Copilot AI review requested due to automatic review settings April 10, 2026 14:05
@github-actions

github-actions Bot commented Apr 10, 2026 •

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16038

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16038"

@edmondshtogu

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Go as a first-class “polyglot” validation language by introducing Go AppHost fixtures across many Aspire.Hosting integrations, wiring them into CI validation, and updating the Go ATS transport to support server-initiated callbacks without deadlocking.

Changes:

  • Add Go validation AppHosts (go.mod + aspire.config.json + apphost.go) for a broad set of Aspire.Hosting integrations under tests/PolyglotAppHosts/*/Go.
  • Add a Go playground AppHost and a CI script to regenerate Go SDK modules and compile-check all Go fixtures; wire it into the polyglot-validation Go container.
  • Update the generated Go transport client to use a background reader + pending-response map to allow nested capability calls during callbacks.

Reviewed changes

Copilot reviewed 151 out of 151 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Aspire.Hosting.CodeGeneration.Go/Resources/transport.go Switch Go JSON-RPC client to background read loop + pending response dispatch to support callback reentrancy.
.github/workflows/polyglot-validation/test-go-playground.sh New script that restores + go builds all Go validation AppHosts under tests/PolyglotAppHosts/*/Go.
.github/workflows/polyglot-validation/Dockerfile.go Run the new Go validation script in the polyglot-validation Go container image.
playground/GoAppHost/go.mod Go module stub for the Go playground AppHost.
playground/GoAppHost/aspire.config.json Configure the Go playground AppHost (language + entrypoint).
playground/GoAppHost/apphost.run.json Run profile/env for local Go playground execution.
playground/GoAppHost/apphost.go Minimal Go playground AppHost entrypoint.
tests/PolyglotAppHosts/Aspire.Hosting/Go/go.mod Go module stub for Aspire.Hosting (core) validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting/Go/aspire.config.json Go AppHost config for Aspire.Hosting (core).
tests/PolyglotAppHosts/Aspire.Hosting/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting (core).
tests/PolyglotAppHosts/Aspire.Hosting.Yarp/Go/go.mod Go module stub for Aspire.Hosting.Yarp validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Yarp/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Yarp.
tests/PolyglotAppHosts/Aspire.Hosting.Yarp/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Yarp.
tests/PolyglotAppHosts/Aspire.Hosting.Valkey/Go/go.mod Go module stub for Aspire.Hosting.Valkey validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Valkey/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Valkey.
tests/PolyglotAppHosts/Aspire.Hosting.Valkey/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Valkey.
tests/PolyglotAppHosts/Aspire.Hosting.SqlServer/Go/go.mod Go module stub for Aspire.Hosting.SqlServer validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.SqlServer/Go/aspire.config.json Go AppHost config for Aspire.Hosting.SqlServer.
tests/PolyglotAppHosts/Aspire.Hosting.SqlServer/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.SqlServer.
tests/PolyglotAppHosts/Aspire.Hosting.Seq/Go/go.mod Go module stub for Aspire.Hosting.Seq validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Seq/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Seq.
tests/PolyglotAppHosts/Aspire.Hosting.Seq/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Seq.
tests/PolyglotAppHosts/Aspire.Hosting.Redis/Go/go.mod Go module stub for Aspire.Hosting.Redis validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Redis/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Redis.
tests/PolyglotAppHosts/Aspire.Hosting.Redis/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Redis.
tests/PolyglotAppHosts/Aspire.Hosting.RabbitMQ/Go/go.mod Go module stub for Aspire.Hosting.RabbitMQ validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.RabbitMQ/Go/aspire.config.json Go AppHost config for Aspire.Hosting.RabbitMQ.
tests/PolyglotAppHosts/Aspire.Hosting.RabbitMQ/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.RabbitMQ.
tests/PolyglotAppHosts/Aspire.Hosting.Qdrant/Go/go.mod Go module stub for Aspire.Hosting.Qdrant validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Qdrant/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Qdrant.
tests/PolyglotAppHosts/Aspire.Hosting.Qdrant/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Qdrant.
tests/PolyglotAppHosts/Aspire.Hosting.Python/Go/go.mod Go module stub for Aspire.Hosting.Python validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Python/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Python.
tests/PolyglotAppHosts/Aspire.Hosting.Python/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Python.
tests/PolyglotAppHosts/Aspire.Hosting.PostgreSQL/Go/go.mod Go module stub for Aspire.Hosting.PostgreSQL validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.PostgreSQL/Go/aspire.config.json Go AppHost config for Aspire.Hosting.PostgreSQL.
tests/PolyglotAppHosts/Aspire.Hosting.PostgreSQL/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.PostgreSQL.
tests/PolyglotAppHosts/Aspire.Hosting.Orleans/Go/go.mod Go module stub for Aspire.Hosting.Orleans validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Orleans/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Orleans.
tests/PolyglotAppHosts/Aspire.Hosting.Orleans/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Orleans.
tests/PolyglotAppHosts/Aspire.Hosting.Oracle/Go/go.mod Go module stub for Aspire.Hosting.Oracle validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Oracle/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Oracle.
tests/PolyglotAppHosts/Aspire.Hosting.Oracle/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Oracle.
tests/PolyglotAppHosts/Aspire.Hosting.OpenAI/Go/go.mod Go module stub for Aspire.Hosting.OpenAI validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.OpenAI/Go/aspire.config.json Go AppHost config for Aspire.Hosting.OpenAI.
tests/PolyglotAppHosts/Aspire.Hosting.OpenAI/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.OpenAI.
tests/PolyglotAppHosts/Aspire.Hosting.Nats/Go/go.mod Go module stub for Aspire.Hosting.Nats validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Nats/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Nats.
tests/PolyglotAppHosts/Aspire.Hosting.Nats/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Nats.
tests/PolyglotAppHosts/Aspire.Hosting.MySql/Go/go.mod Go module stub for Aspire.Hosting.MySql validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.MySql/Go/aspire.config.json Go AppHost config for Aspire.Hosting.MySql.
tests/PolyglotAppHosts/Aspire.Hosting.MySql/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.MySql.
tests/PolyglotAppHosts/Aspire.Hosting.MongoDB/Go/go.mod Go module stub for Aspire.Hosting.MongoDB validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.MongoDB/Go/aspire.config.json Go AppHost config for Aspire.Hosting.MongoDB.
tests/PolyglotAppHosts/Aspire.Hosting.MongoDB/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.MongoDB.
tests/PolyglotAppHosts/Aspire.Hosting.Milvus/Go/go.mod Go module stub for Aspire.Hosting.Milvus validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Milvus/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Milvus.
tests/PolyglotAppHosts/Aspire.Hosting.Milvus/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Milvus.
tests/PolyglotAppHosts/Aspire.Hosting.Maui/Go/go.mod Go module stub for Aspire.Hosting.Maui validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Maui/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Maui.
tests/PolyglotAppHosts/Aspire.Hosting.Maui/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Maui.
tests/PolyglotAppHosts/Aspire.Hosting.Kubernetes/Go/go.mod Go module stub for Aspire.Hosting.Kubernetes validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Kubernetes/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Kubernetes.
tests/PolyglotAppHosts/Aspire.Hosting.Kubernetes/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Kubernetes.
tests/PolyglotAppHosts/Aspire.Hosting.Keycloak/Go/go.mod Go module stub for Aspire.Hosting.Keycloak validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Keycloak/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Keycloak.
tests/PolyglotAppHosts/Aspire.Hosting.Keycloak/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Keycloak.
tests/PolyglotAppHosts/Aspire.Hosting.Kafka/Go/go.mod Go module stub for Aspire.Hosting.Kafka validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Kafka/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Kafka.
tests/PolyglotAppHosts/Aspire.Hosting.Kafka/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Kafka.
tests/PolyglotAppHosts/Aspire.Hosting.JavaScript/Go/go.mod Go module stub for Aspire.Hosting.JavaScript validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.JavaScript/Go/aspire.config.json Go AppHost config for Aspire.Hosting.JavaScript.
tests/PolyglotAppHosts/Aspire.Hosting.JavaScript/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.JavaScript.
tests/PolyglotAppHosts/Aspire.Hosting.GitHub.Models/Go/go.mod Go module stub for Aspire.Hosting.GitHub.Models validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.GitHub.Models/Go/aspire.config.json Go AppHost config for Aspire.Hosting.GitHub.Models.
tests/PolyglotAppHosts/Aspire.Hosting.GitHub.Models/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.GitHub.Models.
tests/PolyglotAppHosts/Aspire.Hosting.Garnet/Go/go.mod Go module stub for Aspire.Hosting.Garnet validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Garnet/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Garnet.
tests/PolyglotAppHosts/Aspire.Hosting.Garnet/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Garnet.
tests/PolyglotAppHosts/Aspire.Hosting.Foundry/Go/go.mod Go module stub for Aspire.Hosting.Foundry validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Foundry/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Foundry.
tests/PolyglotAppHosts/Aspire.Hosting.Foundry/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Foundry.
tests/PolyglotAppHosts/Aspire.Hosting.Docker/Go/go.mod Go module stub for Aspire.Hosting.Docker validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Docker/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Docker.
tests/PolyglotAppHosts/Aspire.Hosting.Docker/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Docker.
tests/PolyglotAppHosts/Aspire.Hosting.DevTunnels/Go/go.mod Go module stub for Aspire.Hosting.DevTunnels validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.DevTunnels/Go/aspire.config.json Go AppHost config for Aspire.Hosting.DevTunnels.
tests/PolyglotAppHosts/Aspire.Hosting.DevTunnels/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.DevTunnels.
tests/PolyglotAppHosts/Aspire.Hosting.Azure/Go/go.mod Go module stub for Aspire.Hosting.Azure validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Azure/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Azure.
tests/PolyglotAppHosts/Aspire.Hosting.Azure/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Azure.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.WebPubSub/Go/go.mod Go module stub for Aspire.Hosting.Azure.WebPubSub validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.WebPubSub/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Azure.WebPubSub.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.WebPubSub/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Azure.WebPubSub.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.Storage/Go/go.mod Go module stub for Aspire.Hosting.Azure.Storage validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.Storage/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Azure.Storage.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.Storage/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Azure.Storage.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.Sql/Go/go.mod Go module stub for Aspire.Hosting.Azure.Sql validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.Sql/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Azure.Sql.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.Sql/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Azure.Sql.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.SignalR/Go/go.mod Go module stub for Aspire.Hosting.Azure.SignalR validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.SignalR/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Azure.SignalR.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.SignalR/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Azure.SignalR.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.ServiceBus/Go/go.mod Go module stub for Aspire.Hosting.Azure.ServiceBus validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.ServiceBus/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Azure.ServiceBus.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.ServiceBus/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Azure.ServiceBus.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.Search/Go/go.mod Go module stub for Aspire.Hosting.Azure.Search validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.Search/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Azure.Search.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.Search/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Azure.Search.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.Redis/Go/go.mod Go module stub for Aspire.Hosting.Azure.Redis validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.Redis/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Azure.Redis.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.Redis/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Azure.Redis.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.PostgreSQL/Go/go.mod Go module stub for Aspire.Hosting.Azure.PostgreSQL validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.PostgreSQL/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Azure.PostgreSQL.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.PostgreSQL/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Azure.PostgreSQL.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.OperationalInsights/Go/go.mod Go module stub for Aspire.Hosting.Azure.OperationalInsights validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.OperationalInsights/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Azure.OperationalInsights.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.OperationalInsights/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Azure.OperationalInsights.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.Kusto/Go/go.mod Go module stub for Aspire.Hosting.Azure.Kusto validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.Kusto/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Azure.Kusto.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.Kusto/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Azure.Kusto.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.KeyVault/Go/go.mod Go module stub for Aspire.Hosting.Azure.KeyVault validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.KeyVault/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Azure.KeyVault.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.KeyVault/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Azure.KeyVault.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.Functions/Go/go.mod Go module stub for Aspire.Hosting.Azure.Functions validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.Functions/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Azure.Functions.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.Functions/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Azure.Functions.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.EventHubs/Go/go.mod Go module stub for Aspire.Hosting.Azure.EventHubs validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.EventHubs/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Azure.EventHubs.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.EventHubs/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Azure.EventHubs.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.CosmosDB/Go/go.mod Go module stub for Aspire.Hosting.Azure.CosmosDB validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.CosmosDB/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Azure.CosmosDB.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.CosmosDB/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Azure.CosmosDB.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.ContainerRegistry/Go/go.mod Go module stub for Aspire.Hosting.Azure.ContainerRegistry validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.ContainerRegistry/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Azure.ContainerRegistry.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.ContainerRegistry/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Azure.ContainerRegistry.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.CognitiveServices/Go/go.mod Go module stub for Aspire.Hosting.Azure.CognitiveServices validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.CognitiveServices/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Azure.CognitiveServices.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.CognitiveServices/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Azure.CognitiveServices.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.AppService/Go/go.mod Go module stub for Aspire.Hosting.Azure.AppService validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.AppService/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Azure.AppService.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.AppService/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Azure.AppService.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.ApplicationInsights/Go/go.mod Go module stub for Aspire.Hosting.Azure.ApplicationInsights validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.ApplicationInsights/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Azure.ApplicationInsights.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.ApplicationInsights/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Azure.ApplicationInsights.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.AppContainers/Go/go.mod Go module stub for Aspire.Hosting.Azure.AppContainers validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.AppContainers/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Azure.AppContainers.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.AppContainers/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Azure.AppContainers.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.AppConfiguration/Go/go.mod Go module stub for Aspire.Hosting.Azure.AppConfiguration validation AppHost.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.AppConfiguration/Go/aspire.config.json Go AppHost config for Aspire.Hosting.Azure.AppConfiguration.
tests/PolyglotAppHosts/Aspire.Hosting.Azure.AppConfiguration/Go/apphost.go Go API surface validation AppHost for Aspire.Hosting.Azure.AppConfiguration.

@edmondshtogu edmondshtogu (edmondshtogu) changed the title feat: go polyglot feat(go): complete Go polyglot AppHost parity — fix transport deadlock, add fixtures, playground, and CI validation (#15813) Apr 10, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 151 out of 151 changed files in this pull request and generated 3 comments.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 151 out of 151 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

src/Aspire.Hosting.CodeGeneration.Go/Resources/transport.go:556

  • readMessage() reads c.reader without synchronization, but closeConnection() sets c.reader = nil under mu. Calling Disconnect() while readLoop is in readMessage() can therefore introduce a data race on c.reader. Snapshot the reader under mu (similar to how writeMessage snapshots conn) and use the local reader variable for the rest of the function to keep the "mu guards reader" contract intact.
func (c *AspireClient) readMessage() (map[string]any, error) {
	if c.reader == nil {
		return nil, errors.New("not connected")
	}

	headers := make(map[string]string)
	for {
		line, err := c.reader.ReadString('\n')
		if err != nil {

@davidfowl

Copy link
Copy Markdown
Collaborator

The lack of fluent APIs hurts my eyes. Can we make that work here as well? Just do error propagation in those methods that chain the calls.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 151 out of 151 changed files in this pull request and generated 5 comments.

@edmondshtogu edmondshtogu (edmondshtogu) changed the title feat(go): complete Go polyglot AppHost parity — fix transport deadlock, add fixtures, playground, and CI validation (#15813) feat: Go polyglot AppHost — fixtures, playground, transport fixes, fluent API Apr 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Re-running the failed jobs in the CI workflow for this pull request because 2 jobs were identified as retry-safe transient failures in the CI run attempt.
GitHub was asked to rerun all failed jobs for that attempt, and the rerun is being tracked in the rerun attempt.
The job links below point to the failed attempt jobs that matched the retry-safe transient failure rules.

Matched test failure patterns (3 tests)
  • Aspire.Cli.EndToEnd.Tests.StartStopTests.AddPackageWhileAppHostRunningDetached — MCR registry rate limiting (HTTP 403)
  • Aspire.Cli.EndToEnd.Tests.StartStopTests.StopWithNoRunningAppHostExitsSuccessfully — MCR registry rate limiting (HTTP 403)
  • Aspire.Cli.EndToEnd.Tests.StartStopTests.AddPackageInteractiveWhileAppHostRunningDetached — MCR registry rate limiting (HTTP 403)

@edmondshtogu

Copy link
Copy Markdown
Contributor Author

Sébastien Ros (@sebastienros) is there something I can help with? I see you resolved the comments you mentioned!

@sebastienros

Copy link
Copy Markdown
Contributor

edmondshtogu (@edmondshtogu) you can test the latest changes maybe

@edmondshtogu

Copy link
Copy Markdown
Contributor Author

Sébastien Ros (@sebastienros) I've tested the latest changes; apphost.go is now working as expected and the endpoint issues are resolved. Additionally, I've wired up OpenTelemetry to correctly export both traces and metrics.

@sebastienros

Copy link
Copy Markdown
Contributor

Karol Zadora-Przylecki (@karolz-ms) you have requested changes, can you verify if it's still pending?

@sebastienros
Sébastien Ros (sebastienros) dismissed Karol Zadora-Przylecki (karolz-ms)’s stale review May 1, 2026 14:08

I believe the only request you made was 1.26 which I did

@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

Re-running the failed jobs in the CI workflow for this pull request because 2 jobs were identified as retry-safe transient failures in the CI run attempt.
GitHub was asked to rerun all failed jobs for that attempt, and the rerun is being tracked in the rerun attempt.
The job links below point to the failed attempt jobs that matched the retry-safe transient failure rules.

Matched test failure patterns (27 tests)
  • Aspire.Cli.EndToEnd.Tests.BundleSmokeTests.CreateAndRunAspireStarterProjectWithBundle — MCR registry rate limiting (HTTP 403)
  • Aspire.Microsoft.Data.SqlClient.Tests.ConformanceTests.TracingEnablesTheRightActivitySource — MCR container pull denied (rate limiting)
  • Aspire.Microsoft.Data.SqlClient.Tests.ConformanceTests.TracingEnablesTheRightActivitySource_Keyed — MCR container pull denied (rate limiting)
  • Aspire.Microsoft.Data.SqlClient.Tests.ConformanceTests.OptionsTypeIsSealed — MCR container pull denied (rate limiting)
  • Aspire.Microsoft.Data.SqlClient.Tests.ConformanceTests.HealthChecksRegistersHealthCheckService(enabled: True) — MCR container pull denied (rate limiting)
  • Aspire.Microsoft.Data.SqlClient.Tests.ConformanceTests.HealthChecksRegistersHealthCheckService(enabled: False) — MCR container pull denied (rate limiting)
  • Aspire.Microsoft.Data.SqlClient.Tests.ConformanceTests.EachKeyedComponentRegistersItsOwnHealthCheck — MCR container pull denied (rate limiting)
  • Aspire.Microsoft.Data.SqlClient.Tests.ConformanceTests.TracingRegistersTraceProvider(enabled: True) — MCR container pull denied (rate limiting)
  • Aspire.Microsoft.Data.SqlClient.Tests.ConformanceTests.TracingRegistersTraceProvider(enabled: False) — MCR container pull denied (rate limiting)
  • Aspire.Microsoft.Data.SqlClient.Tests.ConformanceTests.MetricsRegistersMeterProvider(enabled: True) — MCR container pull denied (rate limiting)
  • ...and 17 more

@sebastienros
Sébastien Ros (sebastienros) merged commit 8e2cead into microsoft:main May 1, 2026
564 of 571 checks passed
@github-actions github-actions Bot added this to the 13.4 milestone May 1, 2026
@edmondshtogu
edmondshtogu (edmondshtogu) deleted the feat/go-polyglot branch May 1, 2026 20:11
Nell Shamrell-Harrington (nellshamrell) pushed a commit to nellshamrell/aspire that referenced this pull request May 18, 2026
…PI (microsoft#16038)

* feat: go polyglot

* feat: go polyglot...

* fix: race + duplicate callbacks & panic on non-float64 ID

* fix: closeConnection / writeMessage race & yarp fixture & jsonRPCID string support

* fix: close connection so write fails fast

* fix: addressing reviews comments

* fix: test

* fix: remaining test + addressing copilot reviews

* fix: test-go.sh output

* fix: removed the _resourceBuilderTypeIds field and the population loop since the fluent decision already works correctly using isResourceBuilder (from the handle type) and returnsSameType (from struct name comparison) — no additional set was needed

* fix: extending fluent func calls to "Add*" and adjusted tests

* chore: fixing generation

* chore: staging up

* core: fixing generator

* chore: indenting

* chore: adding template + fixing test

* fix: tests

* fix: go-starter template to run the api and use dependencies

* chore: removing http endpoint

* fix: missing params in template + test script

* chore: fix merge issues

* Update Dockerfile.golang

* Fix Go starter endpoint and version

Co-authored-by: Copilot <[email protected]>

* Avoid disabling TLS validation in Go starter

Co-authored-by: Copilot <[email protected]>

* Deduplicate Go union type checks

Co-authored-by: Copilot <[email protected]>

* Update Go Redis validation for canonical API

Co-authored-by: Copilot <[email protected]>

* Use createBuilder capability in Go SDK

Co-authored-by: Copilot <[email protected]>

* Update Go validation fixtures for canonical APIs

Co-authored-by: Copilot <[email protected]>

* Update Go coverage after upstream merge

Co-authored-by: Copilot <[email protected]>

* chore: enabling otel in the go template

* Update Foundry ACA deployment snapshot

Co-authored-by: Copilot <[email protected]>

* Update Go hosting fixture environment calls

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Sebastien Ros <[email protected]>
Co-authored-by: Copilot <[email protected]>
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Enable Go-based Polyglot AppHost (apphost.go) via JSON-RPC

5 participants