Skip to content

Add a Go AppHost tooling check to aspire doctor - #21196

Merged
David Pine (IEvangelist) merged 5 commits into
mainfrom
ievangelist-go-doctor-check
Oct 28, 2026
Merged

David Pine (IEvangelist) merged 5 commits into
mainfrom
ievangelist-go-doctor-check

Conversation

@IEvangelist

@IEvangelist David Pine (IEvangelist) commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Description

aspire doctor checks the TypeScript AppHost toolchain but says nothing about Go. A Go AppHost needs a Go toolchain at or above the go 1.26 directive in the generated SDK and the scaffolded go.mod, and aspire run without one fails late with a raw process-start error.

This adds GoAppHostToolingCheck (order 33, next to TypeScriptAppHostToolingCheck). It runs only for a Go AppHost, so other AppHost languages see no change. The configured AppHost is authoritative: when settings select an AppHost of another language there are no Go checks. When none is configured, the check looks for apphost.go in the working directory.

Check name Status When
go-apphost-go Fail go is not on PATH (includes the install link)
go-apphost-version Fail Go is older than 1.21, or the effective GOTOOLCHAIN is local (Go never switches toolchains, so it cannot satisfy the AppHost's go 1.26)
go-apphost-version Warning Go 1.21 to 1.25 and the effective GOTOOLCHAIN is path, local+path or <name>+path: Go only switches to a newer toolchain that is already on PATH (for example go1.26.0), and the check does not read go.mod, so it cannot tell whether one is there
go-apphost-version Warning Go 1.21 to 1.25 and Go can download the required toolchain: any other GOTOOLCHAIN (auto, <name>, <name>+auto), or no readable answer from go env GOTOOLCHAIN
go-apphost-version Warning go version prints nothing readable (inconclusive, not proven broken)
go-apphost-tools Pass Go 1.26 or later, with the installed version

Details worth knowing:

  • The effective GOTOOLCHAIN is only needed for Go 1.21 up to 1.25. Nothing extra runs for Go 1.26 or later, or for Go older than 1.21. The go command takes the value from the process environment, then from the user config that go env -w writes, then from $GOROOT/go.env. Fedora's Go package ships GOTOOLCHAIN=local in that go.env (Fedora docs). A non-empty process variable is used as is. Otherwise the check runs go env GOTOOLCHAIN with the same 5 s timeout as the version probe, and a failure or empty output counts as auto, which keeps the Warning.
  • That go env GOTOOLCHAIN runs in a fresh empty directory under the temp folder, deleted afterwards, never in the AppHost directory, because doctor must not download a toolchain, and go commands that read a go.mod can trigger a download. Measured in a directory whose go.mod says go 1.99: on Go 1.24.1 and 1.27.0 go env GOTOOLCHAIN printed auto without switching, while go version there tries to download go1.99.0. The empty directory keeps the probe independent of that behaviour; it is defence in depth, not a documented guarantee.
  • go version runs with GOTOOLCHAIN=local. With the default auto, every go command runs toolchain selection first, so a Go older than the go.mod in the current directory tries to download that toolchain instead of reporting the installed version. On Go 1.24.1 in the go 1.99 directory go version failed after 0.8 s; with local it answered in 0.04 s.
  • Both probes launch go through IProcessExecutionFactory, like the other CLI child processes: the ASPIRE_CLI_* identity variables are stripped from the environment, output encodings are pinned, and each launch is debug-logged. A go that outlives the 5 s timeout is killed together with its process tree. Standard output and standard error are collected separately: go reports notices such as a toolchain download on standard error, and they must not end up in the version string or in the GOTOOLCHAIN value that the callers parse. A non-zero exit is logged at debug level with its standard error and counts as no answer.
  • Only GOTOOLCHAIN=local proves failure. In every mode go looks in PATH for the exact toolchain that go.mod names (the go line go 1.26 becomes go1.26.0), and the path modes fail only when that executable is missing (cmd/go/internal/toolchain/select.go). Measured with Go 1.27.0, GOTOOLCHAIN=path and a go.mod that says go 1.99: with no go1.99.0 on PATH, go list . prints go: cannot find "go1.99.0" in PATH; with a go1.99.0 shim on PATH, Go selects and runs it offline; a go1.99.1 shim is not accepted. The check does not read go.mod, so path, local+path and <name>+path are a Warning that names the toolchain to put on PATH, built from MinimumGoVersion.
  • GOTOOLCHAIN values are matched case-sensitively, as the go command does.
  • CommandPathResolver now knows go, so the AppHost launcher reports go is not installed or not found in PATH. Please install Go and try again. with https://go.dev/doc/install instead of a process-start failure.
  • The 1.26 floor is duplicated in the CLI because it cannot reference Aspire.Hosting.CodeGeneration.Go. MinimumGoVersion_MatchesGoModTemplate reads the go directive from the templates in AtsGoCodeGenerator.cs and GoLanguageSupport.cs and fails when they stop matching. A path_rules entry in eng/github-ci/test-trigger-map.yml selects Aspire.Cli.Tests when either file changes, with a guard test in Infrastructure.Tests.
  • The Go language definition is only returned while experimentalPolyglotGo is on, so the check returns no results with the flag off and needs no change when the flag is removed ([Go AppHost preview] Remove the feature flag and expose Go templates #21106). The check asks that definition for apphost.go directly instead of calling DetectLanguageRecursiveAsync, which returns only the first language that matches, and C# matches any *.csproj: a Go AppHost beside a service project would be reported as C#.

Part of #21115

Known limitations

  • A pinned GOTOOLCHAIN=<name> (for example go1.24.1) is not modelled; the check validates the Go on PATH.
  • With path, local+path and <name>+path the check cannot tell whether the toolchain that go.mod names is on PATH, because it does not read go.mod; it warns.
  • go1.26rc1 is accepted as Go 1.26.

Not in this PR

  • Doctor checks for the Python, Java and Rust AppHost toolchains.
  • A language-agnostic AppHost resolver shared by the TypeScript and Go checks. The Go check uses the configured AppHost, then looks for apphost.go directly. TypeScriptAppHostToolingCheck resolves through LegacyTypeScriptAppHost, which is shared with aspire update --migrate and falls back to first-language-wins discovery even when settings select another language's AppHost.

Validation

All commands ran on Windows with the repo-local SDK, on the head of this branch, on top of upstream/main 5ea175ce62. main has since moved ten commits (f4ae2cc424); a trial merge of this branch into it is clean, and the commands were not repeated on the merged result.

Command Result
dotnet build src\Aspire.Cli\Aspire.Cli.csproj -m:2 --no-restore --no-incremental -p:BuildProjectReferences=false 0 warnings, 0 errors
dotnet test --project tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj --no-restore --no-launch-profile -- --filter-class "*.GoAppHostToolingCheckTests" --filter-class "*.TypeScriptAppHostToolingCheckTests" --filter-class "*.DoctorCommandTests" --filter-class "*.EnvironmentCheckerTests" --filter-class "*.CommandPathResolverTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true" 135 passed, 0 failed (59 in GoAppHostToolingCheckTests)
dotnet test --project tests\Infrastructure.Tests\Infrastructure.Tests.csproj --no-restore --no-launch-profile -- --filter-class "*.TestTriggerMapTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true" 178 passed, 0 failed

The GOTOOLCHAIN handling and the AppHost lookup were each tested RED first, against the code before the change, and went GREEN afterwards:

  • Effective GOTOOLCHAIN value: 10 of 45 Go tests failed, including every go.env row (expected Fail, actual Warning).
  • AppHost lookup: 2 of 48 failed (a configured non-Go AppHost with a discoverable apphost.go; apphost.go beside a .csproj with Go missing).
  • Path modes: 10 of 50 failed. The six path, local+path and <name>+path rows expected a Warning and got a Fail, and the four local rows expected the new message.

The probe runner has its own unit tests with the shared TestProcessExecutionFactory. They cover: standard output returned without the standard error notices that go prints; a non-zero exit, which logs the standard error and gives no answer; a process that does not start; start failures (Win32Exception, InvalidOperationException, IOException); a go that outlives the timeout; and caller cancellation. The timeout is a parameter, so the timeout test takes milliseconds. A separate test asserts that the go env GOTOOLCHAIN probe does not override GOTOOLCHAIN.

Real aspire doctor --format json runs of the CLI built from this branch. The scratch directory has an apphost.go beside api\Api.csproj and {"features":{"experimentalPolyglotGo":true}} in aspire.config.json. The installed Go is 1.27.0. For the older-Go rows a go.cmd shim on PATH stands in for Go 1.24.1: it answers version with go version go1.24.1 windows/amd64, answers env GOTOOLCHAIN with a value from a test variable (default auto), and logs its arguments, GOTOOLCHAIN and working directory.

Environment Result
Go 1.27.0 go-apphost-tools pass (go 1.27.0), exit 0
no go on PATH go-apphost-go fail with the install link, exit 1
shim 1.24.1, GOTOOLCHAIN=local in the process environment go-apphost-version fail, exit 1
shim 1.24.1, no process variable, go env GOTOOLCHAIN answers local same fail, exit 1
shim 1.24.1, GOTOOLCHAIN=path go-apphost-version warning: "only lets Go switch to a newer toolchain that is already on PATH (for example go1.26.0)", exit 0
shim 1.24.1, GOTOOLCHAIN=go1.25.0+path same warning, exit 0
shim 1.24.1, no process variable, go env GOTOOLCHAIN answers path same warning, exit 0
shim 1.24.1, default go-apphost-version warning with the download message, exit 0
aspire.config.json selects ../ts/apphost.mts (Go enabled), the working directory also has an apphost.go, no go on PATH no Go entries, exit 0 (the TypeScript check reports the configured AppHost)
experimentalPolyglotGo not set, apphost.go beside api\Api.csproj, no go on PATH no Go entries, exit 0

The shim saw version with GOTOOLCHAIN=local in the AppHost directory. The runs without a process GOTOOLCHAIN also saw env GOTOOLCHAIN, with GOTOOLCHAIN unset, in a fresh %TEMP%\aspire-go-doctor-* directory, and no such directory was left afterwards. Go 1.27.0 reports go-apphost-tools with metadata {"language":"go","appHostPath":"...\\apphost.go","version":"1.27.0"}. Before the AppHost lookup change this layout produced no Go results, even with Go missing (the second RED test above).

An earlier run used the real Go 1.24.1 binary (from a scratch module cache) with GOTOOLCHAIN=local in the process environment, only in the GOENV config file, and only in a go.env under GOROOT. Each gave the same go-apphost-version fail, and the default gave the download warning. The code that reads the effective GOTOOLCHAIN has not changed since.

After the probes moved to IProcessExecutionFactory, the Go 1.27.0 run and the shim rows for GOTOOLCHAIN=local, go env GOTOOLCHAIN answering local or path, and the default were run again on the new head with --log-level Debug. They gave the same results and left no aspire-go-doctor-* directory. The shim saw an empty ASPIRE_CLI_COMMIT although the parent process had a 40-character SHA in it. Three more shim runs:

  • A go that hangs: the debug log shows the wait canceled after 5 s and the kill of the process tree, the check gives the inconclusive warning, and no cmd or ping process was left behind.
  • A go version that writes a notice to standard error: the version is still read from standard output alone and the check carries on to the go env GOTOOLCHAIN probe.
  • A go version that exits with 2 and prints go: cannot find main module to standard error: the debug log shows 'go version' failed with exit code 2: go: cannot find main module, and the check gives the inconclusive warning.

Not run:

  • Linux and macOS.
  • The real Go 1.24.1 binary on this head. The older-Go rows above use the shim; the real-binary runs predate the AppHost lookup, path-mode and process-launch changes.
  • A real go1.26.0 toolchain on PATH with GOTOOLCHAIN=path, end to end. The Go 1.27.0 measurements above, with a copy of go.exe named go1.99.0, show that Go selects a PATH toolchain offline.
  • Go 1.21 to 1.25 other than 1.24.1, and a go.env installed by a real distribution package. The real-binary go.env run used GOROOT pointing at a scratch directory that holds only a go.env.
  • aspire run for a Go AppHost without Go on PATH, end to end. The message comes from the same CommandPathResolver that CommandPathResolverTests covers.
  • The real GitHub conditional-selection run for the new trigger-map rule.
  • A real go.exe that exits with a non-zero code. That path is covered by a unit test and by a go.cmd shim that exits with 2.
  • The rows that never launch a probe (no go on PATH, a configured TypeScript AppHost, experimentalPolyglotGo off) and the GOTOOLCHAIN=go1.25.0+path row were not repeated after the probes moved to the factory.

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • 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
  • 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

aspire doctor now reports Go toolchain problems for a Go AppHost, the way it already does for TypeScript, instead of leaving users to find out when aspire run fails.

GoAppHostToolingCheck stays silent unless the resolved AppHost is apphost.go. It fails when go is not on PATH (with an install link) and checks go version against the Go 1.26 floor declared by the generated SDK go.mod. An older toolchain is a warning when Go can download the required toolchain (GOTOOLCHAIN unset or auto, Go 1.21 or later) and a failure when GOTOOLCHAIN=local or Go predates toolchain switching. A passing check reports the language and version in its metadata.

Also add go to the missing-command table so aspire run prints the friendly install message, and route the generated go.mod templates to Aspire.Cli.Tests in the test trigger map because the drift test reads them.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
The go command takes GOTOOLCHAIN from the process environment, then from the user config written by go env -w, then from $GOROOT/go.env. The check only read the process environment and only treated local as blocking. Fedora's Go package ships GOTOOLCHAIN=local in go.env, and users can run go env -w GOTOOLCHAIN=local. With a Go older than 1.26 on such a machine, doctor warned that Go downloads the toolchain while go run fails with "go.mod requires go >= 1.26 (running go 1.2x; GOTOOLCHAIN=local)".

For Go 1.21 up to 1.25, a non-empty process GOTOOLCHAIN is now used as is. Otherwise the check runs go env GOTOOLCHAIN with the same 5 second timeout as the version probe, in a fresh empty temp directory that is deleted afterwards, never in the AppHost directory, so a go.mod there cannot trigger a toolchain download. An unreadable answer counts as auto. local, path, local+path and <name>+path fail; auto, <name>+auto and a pinned <name> keep the download warning. A pinned GOTOOLCHAIN=<name> is not modelled. Nothing extra runs for Go 1.26 or later, or for Go older than 1.21.

Add tests for each GOTOOLCHAIN source and value, the probe directory lifecycle, and the version probe pinning GOTOOLCHAIN=local.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
@github-actions

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 -- 21196

Or

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

@github-actions

This comment has been minimized.

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.

🟡 Changes recommended

AppHost discovery can skip or misapply Go checks, and offline toolchain selection can incorrectly report failure.

3 open issues
What changed in this PR

Adds Go AppHost tooling diagnostics to aspire doctor, supporting Go general availability work.

Changes:

  • Checks Go availability, minimum version, and toolchain download settings.
  • Adds Go-specific installation guidance.
  • Adds tests and CI routing for minimum-version consistency.
File Description
tests/​Infrastructure.Tests/​TestTriggerMap/​TestTriggerMapTests.cs Tests Go template routing.
tests/​Aspire.Cli.Tests/​Utils/​CommandPathResolverTests.cs Tests missing-Go guidance.
tests/​Aspire.Cli.Tests/​Utils/​CliTestHelper.cs Registers the check for tests.
tests/​Aspire.Cli.Tests/​Commands/​GoAppHostToolingCheckTests.cs Covers diagnostics and version consistency.
src/​Shared/​CommandPathResolver.cs Adds Go installation guidance.
src/​Aspire.Cli/​Utils/​EnvironmentChecker/​GoAppHostToolingCheck.cs Implements Go tooling diagnostics.
src/​Aspire.Cli/​Projects/​ProjectLocator.cs Updates a caller-list comment only.
src/​Aspire.Cli/​Program.cs Registers the Go check.
eng/​github-ci/​test-trigger-map.yml Routes Go template changes to CLI tests.

Review effort: Balanced

The configured AppHost is authoritative. When settings select an
AppHost of another language, that AppHost is the one that runs, so the
check returns no results instead of falling back to discovery and
requiring Go for an unrelated apphost.go in the working directory.

When no AppHost is configured, the check looks for apphost.go through
the Go language definition instead of DetectLanguageRecursiveAsync.
That method returns only the first language that matches, and C#
matches any *.csproj, so a Go AppHost beside a service project was
never checked. The Go language definition is only returned while
experimentalPolyglotGo is on, so the lookup stays feature-gated.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
Only GOTOOLCHAIN=local proves that a Go older than the minimum cannot
run the AppHost: it never switches toolchains. The path modes (path,
local+path and <name>+path) never download, but they look in PATH for
the exact toolchain that go.mod names, for example go1.26.0 for
`go 1.26`, and fail only when it is missing. Doctor does not read
go.mod, so those settings now produce a warning that names the
toolchain to put on PATH instead of a failure.

The local failure now says Go cannot switch to a newer toolchain,
because local also blocks a toolchain that is already on PATH.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

This comment has been minimized.

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.

🟢 Approval recommended

No unresolved blocking issues remain, and the previous findings are addressed by the implementation and regression tests.

No open issues 🎉

3 resolved since last review

Review effort: Balanced

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

Launch 'go version' and 'go env GOTOOLCHAIN' through the shared process
execution factory instead of Process.RunAndCaptureTextAsync, so the probes
get the same child-process behavior as the rest of the CLI: ASPIRE_CLI_*
identity variables are stripped, output encodings are pinned, and each
launch is debug-logged. A hung go is still killed with its process tree
when the 5 second probe timeout elapses.

The probe takes the timeout as a parameter, so the failure, start-failure,
timeout and cancellation paths are covered by unit tests that use the shared
TestProcessExecutionFactory.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
@github-actions

Copy link
Copy Markdown
Contributor

Tests selector

10 / 100 PR test projects · 4 PR jobs, from 9 changed files.

Selected PR test projects (10 / 100)

Aspire.Cli.EndToEnd.Tests, Aspire.Cli.Tests, Aspire.Hosting.CodeGeneration.Go.Tests, Aspire.Hosting.CodeGeneration.Java.Tests, Aspire.Hosting.CodeGeneration.Python.Tests, Aspire.Hosting.CodeGeneration.Rust.Tests, Aspire.Hosting.CodeGeneration.TypeScript.Tests, Aspire.Hosting.RemoteHost.Tests, Aspire.Managed.Tests, Infrastructure.Tests

Selected PR jobs (4)

cli-starter-validation, extension-e2e, polyglot, typescript-api-compat


How these were chosen — grouped by what changed

⚠️ 7 of the 10 selected test projects come from a single change — src/Shared/CommandPathResolver.cs.

🔧 src/Shared/CommandPathResolver.cs (changed source)
→ 7 via the project graph: Aspire.Hosting.CodeGeneration.Go.Tests, Aspire.Hosting.CodeGeneration.Java.Tests, Aspire.Hosting.CodeGeneration.Python.Tests, Aspire.Hosting.CodeGeneration.Rust.Tests, Aspire.Hosting.CodeGeneration.TypeScript.Tests, Aspire.Hosting.RemoteHost.Tests, Aspire.Managed.Tests (2 hops)

📦 affected project Aspire.Cli
→ 1 test: Aspire.Cli.EndToEnd.Tests

📄 eng/github-ci/test-trigger-map.yml (changed)
→ 1 directly: Infrastructure.Tests

🧪 tests/Aspire.Cli.Tests/Commands/GoAppHostToolingCheckTests.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/Utils/CliTestHelper.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Cli.Tests/Utils/CommandPathResolverTests.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Infrastructure.Tests/TestTriggerMap/TestTriggerMapTests.cs (changed test)
→ 1 directly: Infrastructure.Tests

Job reasons

Job Triggered by
cli-starter-validation affected project Aspire.Cli
extension-e2e • src/Aspire.Cli/Program.cs, src/Aspire.Cli/Projects/ProjectLocator.cs, src/Aspire.Cli/Utils/EnvironmentChecker/GoAppHostToolingCheck.cs
• affected project Aspire.Cli
polyglot affected project Aspire.Cli
typescript-api-compat affected project Aspire.Cli

Selection computed for commit aafb9c8.

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.

🟢 Approval recommended

No blocking issues remain, and focused regression coverage addresses diagnostics, process handling, and CI routing; tests were not rerun.

No open issues 🎉

Review effort: Balanced

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@IEvangelist
David Pine (IEvangelist) marked this pull request as ready for review October 21, 2026 21:46

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.

Thanks, this looks good to me. The probes are careful (output is drained before the exit code returns, the process tree is killed on timeout, GOTOOLCHAIN=local is set only on the version probe), the earlier discovery and path-mode issues are fixed with regression tests, and the trigger-map rule covers the go.mod template guard. I ran GoAppHostToolingCheckTests, CommandPathResolverTests and DoctorCommandTests locally on macOS arm64: 110 passed.

One minor inline note below. It can be a follow-up or a small update before merge.

Cross-PR note: #21183 removes the experimentalPolyglotGo flag. Whichever of the two PRs merges second has to drop this PR's use of it. The check itself only relies on GetLanguageById returning the Go definition, but GoAppHostToolingCheckTests.CreateLanguageDiscovery references KnownFeatures.ExperimentalPolyglotGo and CheckAsync_Skips_WhenGoFeatureIsDisabled tests the flag-off path, and the comment in ResolveGoAppHostAsync describes the gating.

@IEvangelist
David Pine (IEvangelist) merged commit 7317791 into main Oct 28, 2026
419 of 422 checks passed
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 17.0 milestone Oct 28, 2026
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

Pull request created: #1966

Generated by PR Documentation Check · copilot · auto · 19.1 AIC · ⌖ 1.14 AIC · ⊞ 7.1K

@aspire-repo-bot

Copy link
Copy Markdown
Contributor

📝 Documentation has been drafted in microsoft/aspire.dev#1966 targeting release/17.0.

Updated aspire-doctor.mdx with the new Go AppHost tooling checks. Triggered signals: pr_body_has_cli_flag_mention, pr_body_has_deprecation_marker (PR body describes new check names and Go version/GOTOOLCHAIN behavior).

Note

This draft PR needs human review before merging.

David Pine (IEvangelist) added a commit that referenced this pull request Nov 5, 2026
> [!IMPORTANT]
> **Merge last.** This PR depends on the other open Go AppHost PRs and
must land after them.
>
> - **Must land first**, because each adds references to the flag that
this PR has to delete: #21189 (E2E helper and call sites), #21195
(`SdkExportCommandTests`) and #21196 (`GoAppHostToolingCheck` and its
tests).
> - **Must land first**, because it edits the same hunk of
`DefaultLanguageDiscovery.cs` and this PR rebases onto it: #21191.
> - **Should land first**, because removing the flag turns Go on for
everyone and these fixes should ship before it: #21186, #21187, #21188,
#21193, #21194, #21197 and #21199.

## Description

Removes the `experimentalPolyglotGo` feature flag so Go AppHosts are
available by default, the same way TypeScript AppHosts are. With no
flag, **Empty (Go AppHost)** and **Starter App (Go API + Redis, Go
AppHost)** are offered by interactive and non-interactive `aspire new`,
and Go is offered by `aspire init` language selection and `--language
go`.

**This is the GA switch for the Go AppHost epic (#21115) and must merge
last**, after the other children have landed: #21108 (E2E, publish,
deploy), #21110 (support policy, API review, packaging), #21112 (docs
and samples) and #21114 (VS Code debugging). It was opened as a draft so
CI exercises the 52 Go fixtures without the flag. It is ready for review
now, but not for merging.

What changed:

- **CLI:** `KnownFeatures` drops the Go flag and
`DefaultLanguageDiscovery` no longer marks Go experimental.
`LanguageInfo.IsExperimental` is kept because Python, Java and Rust
still use it.
- **Leftover key:** a stale `experimentalPolyglotGo` in a user's
configuration is ignored with no warning, matching what happened to the
TypeScript flag when it was removed. `Features` only reads named keys,
and the extension schemas set `additionalProperties: false`, so VS Code
flags the stale key.
- **Extension schemas:** `aspire-config`, `aspire-global-settings` and
`aspire-settings` are regenerated with
`extension/scripts/generate-schema.js`. Only the 16-line Go block is
removed from each.
- **Fixtures and CI:** 52
`tests/PolyglotAppHosts/*/Go/aspire.config.json` files and
`.github/workflows/polyglot-validation/Dockerfile.golang` no longer set
the key.
- **Java E2E picker offsets:** Go is always listed now, so with only the
Java flag set the `aspire init` language picker is C#, TypeScript, Go,
Java, and Java needs 3 Down presses instead of 2. The first CI run on
this PR timed out waiting for `> Java` in `JavaPolyglotTests`,
`JavaCodegenValidationTests` and `JavaPolyglotApphostDirectoryTests`;
each now presses Down once more, with a comment stating the picker
order. The order comes from `DefaultLanguageDiscovery`,
`LanguageService` and `CliTemplateFactory`. TypeScript flows are
unaffected because TypeScript sorts before Go.
- **Tests:** `DefaultLanguageDiscoveryTests`, `NewCommandTests`,
`ConfigCommandTests`, `NewCommandTemplateConfigPersistenceTests` and
`InitCommandTests` now expect Go without the flag, with 6 new tests. One
of them, `GetAvailableLanguagesAsync_ListsLanguagesInPickerOrder`, pins
the picker order so a future ungated language fails a unit test before
it breaks a Docker E2E run.
- **Docs:** `docs/specs/polyglot-apphost.md`, the Go code generation
README and `playground/GoAppHost/apphost.go` no longer mention the flag.

Fixes #21106

## Validation

| Command | Result |
| --- | --- |
| `.\restore.cmd` | passed |
| `dotnet build
tests\Aspire.Cli.EndToEnd.Tests\Aspire.Cli.EndToEnd.Tests.csproj -m:2
--no-restore` | 0 warnings, 0 errors |
| `dotnet test --project tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj
--no-launch-profile -- --filter-class "*.DefaultLanguageDiscoveryTests"
--filter-class "*.NewCommandTests" --filter-class "*.ConfigCommandTests"
--filter-class "*.NewCommandTemplateConfigPersistenceTests"
--filter-class "*.InitCommandTests" --filter-not-trait
"quarantined=true" --filter-not-trait "outerloop=true"` | 312 passed, 0
failed (run before the picker-order test was added) |
| `dotnet test --project tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj
--no-launch-profile -- --filter-class "*.DefaultLanguageDiscoveryTests"
--filter-not-trait "quarantined=true" --filter-not-trait
"outerloop=true"` | 39 passed, 0 failed (38 existing plus the
picker-order test) |
| `node extension\scripts\generate-schema.js` | only the Go block was
removed from each schema |
| repository-wide search for `experimentalPolyglotGo` and its variants |
0 hits |
| JSON parse of the 53 fixtures and 3 schemas | all parse, none contain
the flag |

Run in PR CI instead of locally, all passing on `0e65752d44`: the three
Java E2E tests (`JavaPolyglotTests`, `JavaCodegenValidationTests` and
`JavaPolyglotApphostDirectoryTests`; they need Docker, so CI was the
first execution of the extra Down press), `Infrastructure.Tests` and the
VS Code extension unit and E2E jobs.

Not run: the VS Code new-project flow in an extension host
(`extension/src/commands/new.ts` just runs `aspire new`).

### Before merging

- [ ] Search again for `experimentalPolyglotGo`,
`KnownFeatures.ExperimentalPolyglotGo`,
`EnableExperimentalGoSupportAsync`, `features__experimentalPolyglotGo`
and `experimentalPolyglot:go`, because open Go branches add flag setup
of their own and this PR must merge after all of them. Today that covers
#21189 (the `EnableExperimentalGoSupportAsync` helper and its call sites
in every Go scenario), #21195 (`SdkExportCommandTests` sets
`KnownFeatures.ExperimentalPolyglotGo`) and #21196
(`GoAppHostToolingCheckTests` builds its language discovery with the
flag, including a `goEnabled: false` case that stops being meaningful,
and `GoAppHostToolingCheck` has a comment that describes the flag). Each
of them stops compiling or goes stale once the flag is removed, so
delete or rewrite them here.
- [ ] Rebase onto #21191, which adds `DefaultHostingPackages =
["Aspire.Hosting.Go"]` to Go's `LanguageInfo` in the same hunk of
`DefaultLanguageDiscovery.cs` (#21045). Keep that initializer and drop
`IsExperimental: true`.
- [ ] Drop the Go experimental notes in the aspire.dev API reference and
docs at the same time.

## Checklist

- Is this feature complete?
  - [ ] Yes. Ready to ship.
  - [x] No. Follow-up changes expected.
- Are you including unit tests for the changes and scenario tests if
relevant?
  - [x] Yes
  - [ ] No
- 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
  - [x] No
- 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
  - [x] No

---------

Co-authored-by: David Pine <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
Sébastien Ros (sebastienros) added a commit to microsoft/aspire.dev that referenced this pull request Nov 13, 2026
Documents changes from microsoft/aspire#21196

Author: ``@davidfowl-unknown-placeholder``

Targeting `release/17.0` based on the source PR milestone `17.0`
(`exact_match`).

## Why
`aspire doctor` gained a `GoAppHostToolingCheck` that validates the Go
toolchain for Go AppHosts. The doctor reference page didn't mention it.

## Changes
- Updated
`src/frontend/src/content/docs/reference/cli/commands/aspire-doctor.mdx`
(existing page) with a "Go AppHost checks" entry covering
`go-apphost-go`, `go-apphost-version`, and `go-apphost-tools` outcomes.

> Generated by [PR Documentation
Check](https://github.com/microsoft/aspire/actions/runs/40727728528) for
#21196 · copilot · auto · 19.1 AIC · ⌖ 1.14 AIC · ⊞ 7.1K ·
[◷](https://github.com/search?q=repo%3Amicrosoft%2Faspire.dev+%22gh-aw-workflow-id%3A+pr-docs-check%22&type=pullrequests)

<!-- gh-aw-agentic-workflow: PR Documentation Check, engine: copilot,
model: auto, id: 40727728528, workflow_id: pr-docs-check, run:
https://github.com/microsoft/aspire/actions/runs/40727728528 -->

<!-- gh-aw-workflow-id: pr-docs-check -->
<!-- gh-aw-workflow-call-id: microsoft/aspire/pr-docs-check -->

---------

Co-authored-by: aspire-repo-bot[bot] <268009190+aspire-repo-bot[bot]@users.noreply.github.com>
Co-authored-by: Sébastien Ros <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants