Skip to content

Launch and debug Go AppHosts from the VS Code extension - #21187

Merged
David Pine (IEvangelist) merged 11 commits into
mainfrom
ievangelist-go-vscode-debug
Oct 30, 2026
Merged

David Pine (IEvangelist) merged 11 commits into
mainfrom
ievangelist-go-vscode-debug

Conversation

@IEvangelist

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

Copy link
Copy Markdown
Member

Note

Merge order: #18602 (debug Go resources) lands first, then this PR is rebased onto it. A trial merge of the two heads (this PR at 7a68d6c892, #18602 at 9b3fccfb3d) conflicts in three files with one hunk each: extension/README.md, extension/src/debugger/languages/go.ts and extension/src/test/goDebugger.test.ts. The conflict resolution stays in this PR and keeps #18602's resource-attach behavior next to the Go AppHost launch and debug changes.

Description

The VS Code extension sent every AppHost that was not Node, Rust or Java to the .NET debugger, so apphost.go could not be started or debugged from the Aspire view or F5. This adds the Go AppHost path through the Go extension's Delve adapter, next to the existing Rust and Java AppHost paths.

  • Launch and debug. AspireDebugSession sends .go AppHosts to the existing goDebuggerExtension (debug type go). The CLI's go run <package> command is split by the new parseGoAppHostCommand: the program is the AppHost directory (so sibling .go files compile) and the AppHost's own arguments are forwarded. A command that is not go run <package>, including go run flags such as -tags, fails with a localized message instead of debugging the wrong program. A missing Go extension fails with a localized message instead of VS Code's raw "debug type is not supported" error. The Go AppHost session hides Delve's supportsRestartRequest capability (AppHostTrackerOptions.disableDirectRestart), so the toolbar restart arrives as disconnect with restart: true and takes the ordered Aspire restart instead of restarting only the Go process.
  • Restart. Per the VS Code sources, a toolbar restart of the AppHost child terminates it and about 300 ms later relaunches the same session with its old configuration (debugService.ts, restartSession); the adapter tracker only clears the DAP restart flag of the outgoing request. The Aspire parent now handles only the first termination of the restarted child, so a repeat termination cannot start a second replacement session or retry the stop after an aborted restart, and it stops a session that VS Code starts with that child's id. That watch has no deadline, because VS Code raises the start event only after the adapter's launch request completes, which takes seconds when Delve builds first. It ends when the relaunch starts (and is stopped) or when VS Code reports another termination of that id, which is how it reports a relaunch that failed, was canceled or was stopped (doRestart in debugService.ts). The code is shared by every AppHost language that restarts through the tracker, and it matches only the restarted child's own id, so the replacement AppHost is never affected.
  • Capability. GoLanguageSupport declares ExtensionLaunchCapability = "go-apphost.v1" and the extension advertises it when Go is installed. The existing go capability is not reused: extension builds that can only debug Go resources already advertise it, and routing apphost.go to them would hand it to the .NET debugger. Without the capability the CLI keeps running go run . directly, so CLI-only runs and older extensions are unaffected.
  • Recognition. apphost.go is classified as a Go AppHost for language summaries and launch-failure telemetry, is watched by AppHost discovery, activates the extension (workspaceContains:**/apphost.go) and shows the AppHost explorer actions on .go files.
  • Localization. The Go resource display name and label are localized like the other languages, plus the two new Go AppHost messages (package.nls.json, strings.ts, regenerated aspire-vscode.xlf).
  • The extension README describes Go AppHost debugging.

Part of #21114. This PR covers the Go AppHost half of the issue. It does not land or supersede #18602 and does not add Go to the per-language debugger E2E from #18957.

Not in this PR

  • Add VS Code resource debugging for .NET and Go #18602 (debug Go resources) lands first; see the merge order above. It edits the same Go debugger files plus adapterTracker.ts and adapterTracker.test.ts. This change is additive (parseGoAppHostCommand, one branch in startAppHost, an opt-in disableDirectRestart tracker option, new suites in goDebugger.test.ts and adapterTracker.test.ts), so the rebase needs a small textual merge.
  • The same restart routing for other languages. Per their sources, the Node (js-debug) and Rust (CodeLLDB) adapters also advertise supportsRestartRequest, so their AppHost restarts may take the same direct route. That was read from the adapter sources and not tried live, so only Go changes here; each route would need one disableDirectRestart line once confirmed. The live checks are tracked in VS Code extension: verify AppHost child restart in a live session for each debug adapter #21211.
  • lifecycleManagedByParent on the child session, which would give the Aspire parent the toolbar restart outright. It changes stop and restart routing for every language and resource, so it needs its own design and a live check.
  • The matcher that adopts a started AppHost session still compares only runId, which is '' for AppHosts. A relaunch that VS Code starts while a replacement session waits for its AppHost could match it. The new watch stops such a relaunch by id, but the matcher is unchanged here (tracked in VS Code extension: verify AppHost child restart in a live session for each debug adapter #21211).
  • Go in the per-language debugger E2E (extension/src/test-e2e). It needs a Go toolchain, golang.go and Delve on the runner. Add VS Code resource debugging for .NET and Go #18602 already adds that setup, so once it lands the Go AppHost launch and debug E2E reuses it instead of duplicating it. Its resource-attach tests cover a different path and do not replace the AppHost-specific coverage.
  • A preflight for a missing Delve (dlv). The Go extension's own prompt is the only guidance today.

Validation

All commands ran in extension/ (yarn) or the repo root (dotnet) on Windows, on top of upstream/main 82c3b01ce1.

Command Result
yarn run compile-tests passed
yarn run compile passed (4 warnings, all from node_modules)
yarn run lint passed
yarn run unit-test --grep "AppHost restart relaunch|Debug Adapter Tracker Tests|Go AppHost Launch Tests|Go (Debugger|AppHost)" 71 passing
yarn run unit-test (VS Code 1.131.0) 3718 passing, 8 pending, 2 failing
dotnet test --project tests\Aspire.Hosting.CodeGeneration.Go.Tests\Aspire.Hosting.CodeGeneration.Go.Tests.csproj --no-launch-profile -- --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true" 35 passed, 0 failed (run at 1f107edbf2; the two commits after it change only files under extension/)

The 10 AppHost restart relaunch tests give 1 passing and 9 failing against the production code from before the termination guard and the relaunch watch (80a0be8d3a), and 10 passing with them. Two of them, a relaunch whose start arrives 60 s after the restart and a relaunch that ends without starting, also fail (8 passing, 2 failing) against a watch that stops after a fixed 10 s window, which is why this watch has no deadline.

The 2 failing tests are both in E2E download cache (e2eDownloadCache.test.ts) and are not touched by this change. A control run of yarn run unit-test --grep "E2E download cache" at base 234f8fbe54, with none of these changes, fails the same two tests with the same assertions (64 passing, 2 failing). They are specific to the machine used here: a Windows Dev Drive (ReFS) where file ids exceed 2^53 and collide as JavaScript Numbers, and a ctimeMs change on the first read of a file under on-access antivirus. The CI job that runs extension unit tests (Tests / Run VS Code extension unit tests (Windows), windows-latest) passed on main at 234f8fbe54, 82c3b01ce1 and bef0cd8f73. An earlier full run on this machine under heavy load (7 minutes instead of 2) also hit three 20 s Mocha timeouts: one in E2E launch profile and two in E2E download cache. Rerunning those two suites alone gave 159 passing and 2 failing (the same two known failures), and the final full run above shows no timeouts, so they were load-related; there is no control run at the base commit for them.

Not verified:

  • A real session with golang.go and Delve (breakpoint hit, Run Without Debugging, restart and stop). Restart routing is covered by protocol-level unit tests through createDebugAdapterTracker and by reading the Delve and VS Code sources, not by a live restart.
  • How many child launches a live restart produces. The termination guard and the relaunch watch are covered by extension-host unit tests that raise the terminate and start events by hand. Whether VS Code cancels the relaunch it schedules (per debugSession.ts it does so only when the parent session has already ended), whether a Delve relaunch that builds for many seconds is stopped once it starts, and whether stopping a relaunched Go child under Delve is clean, were not run (tracked in VS Code extension: verify AppHost child restart in a live session for each debug adapter #21211). A relaunch that never reports a start or another termination would keep the watch's two listeners, which only compare session ids, until the extension host restarts; per debugService.ts every relaunch outcome raises one of those events.
  • The aspire run CLI-to-extension handoff end to end. The CLI side is covered by GetRuntimeSpec_RequiresTheVersionedGoAppHostExtensionCapability, the extension side by unit tests.
  • Behavior when Delve is missing.
  • The extension E2E harness.

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

The extension sent every non-Rust, non-Java, non-Node AppHost to the .NET debugger, so apphost.go was never debugged. Route .go AppHosts to the Go extension's Delve adapter, launching the AppHost package with the environment the CLI provides, and fail with a localized message when the Go extension is missing or the launch command is not `go run <package>`.

The extension advertises a versioned go-apphost.v1 capability for this. The existing `go` capability is not reused because extension builds that only debug Go resources already advertise it.

Also localize the Go resource display name and label like the other languages.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
Classify apphost.go as a Go AppHost for language summaries and launch-failure telemetry, watch it during AppHost discovery, activate the extension when a workspace contains it, and show the AppHost explorer actions on .go files.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
Let aspire run hand a Go AppHost to the VS Code extension for debugging when the extension reports go-apphost.v1. Without the capability the CLI keeps starting go run . directly, so CLI-only runs and older extensions are unaffected.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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 -- 21187

Or

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

@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.

🔵 Needs a closer look

Restart handling remains unresolved, and real Delve sessions and CLI-to-extension handoff still require validation.

1 open issue
What changed in this PR

Adds Go AppHost launch and debugging through the VS Code Go extension, with a versioned capability that preserves fallback behavior for older extensions.

Changes:

  • Routes Go AppHosts through Delve with command parsing and setup guidance.
  • Adds Go discovery, activation, language classification, and localization.
  • Adds unit coverage and updates documentation.
File Description
tests/​Aspire.Hosting.CodeGeneration.Go.Tests/​GoLanguageSupportTests.cs Tests runtime command and capability.
src/​Aspire.Hosting.CodeGeneration.Go/​GoLanguageSupport.cs Declares versioned launch capability.
extension/​src/​utils/​appHostLanguage.ts Classifies Go AppHosts.
extension/​src/​utils/​appHostDiscovery.ts Watches Go AppHost files.
extension/​src/​test/​strings.test.ts Checks Go localization entries.
extension/​src/​test/​packageManifest.test.ts Tests activation and explorer menus.
extension/​src/​test/​launchFailureStore.test.ts Tests provider classification.
extension/​src/​test/​goDebugger.test.ts Tests parsing and launch configuration.
extension/​src/​test/​appHostLanguage.test.ts Tests Go language detection.
extension/​src/​test/​appHostDiscovery.test.ts Tests Go discovery behavior.
extension/​src/​test-e2e/​packageSurface.e2e.test.ts Updates expected activation events.
extension/​src/​services/​launchFailureStore.ts Identifies Go launch failures.
extension/​src/​loc/​strings.ts Adds localized Go messages.
extension/​src/​debugger/​languages/​go.ts Parses Go AppHost commands.
extension/​src/​debugger/​AspireDebugSession.ts Routes Go AppHosts to Delve.
extension/​src/​capabilities.ts Advertises Go AppHost support.
extension/​README.md Documents Go AppHost debugging.
extension/​package.nls.json Adds Go localization source entries.
extension/​package.json Enables Go activation and explorer actions.
extension/​loc/​xlf/​aspire-vscode.xlf Updates generated localization catalog.

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.

@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.

Delve advertises supportsRestartRequest, so VS Code restarts a Go AppHost
with a DAP restart request. That request only restarts the Go process and
never reaches the ordered Aspire shutdown and relaunch, which is driven by
disconnect with restart: true.

The shared tracker now clears the capability in the initialize response of
an owned Go AppHost session (AppHostTrackerOptions.disableDirectRestart),
so the toolbar restart takes the disconnect route that onRestartRequested
handles. Resource sessions and AppHosts in other languages keep the
adapter's capabilities.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
@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

Restart handling still permits an independent Go child relaunch outside Aspire’s ordered cleanup.

1 open issue
1 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.

VS Code restarts a session whose adapter does not advertise supportsRestartRequest by terminating it and, about 300 ms later, relaunching the same session id with its old configuration (debugService.ts restartSession). The adapter tracker only clears the DAP restart flag of the outgoing request, so nothing in the Aspire parent stopped that relaunch, and the ordered shutdown skips an AppHost child that has already terminated.

Make the termination handler idempotent per restarted child, so a repeat termination of the same id cannot start a second replacement session or retry the stop after an aborted restart. Watch for the relaunch for 10 s after a handled restart and stop a session that starts with the restarted child's id. The watch matches only that id, so the replacement AppHost is never affected, and it applies to every language that restarts through the tracker.

Covered by extension-host unit tests that drive the event sequence by hand. Not verified in a live VS Code session with Delve.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
@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

Slow Delve launches can outlive the restart cleanup window and leave a stale AppHost child running.

1 open issue
1 resolved since last review

Review effort: Balanced

The watch that stops the AppHost child VS Code relaunches during a restart
ended after a fixed 10 s. VS Code raises the start event only after the
adapter's launch request completes, which takes longer than that when the
adapter builds first (Delve building a Go AppHost), so a relaunch that
completed later escaped the watch and ran next to the replacement session.

The watch now ends on what VS Code reports instead of elapsed time: a start
event for the restarted child's id (the relaunch is stopped) or another
termination of that id (the relaunch failed, was canceled or was stopped).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.

@IEvangelist

Copy link
Copy Markdown
Member Author

I'd like to land #18602 first, then have this PR rebased onto it.

Agreed, and the description now says so:

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 is a careful change. The Go AppHost launch path, the versioned go-apphost.v1 capability gate and the localization all look right to me, and the new suites cover the relaunch scenarios thoroughly. I checked restartSession in VS Code's debugService.ts: it relaunches the same session id after 300 ms, then raises either a new start or a final end. That matches the model the relaunch watch relies on. Approving. The items below are minor, so they can be small updates before merge or follow-ups.

  • The restart changes also apply to the other AppHost languages. The restartHandled guard, stopRelaunchedAppHostSession and the debugSessionId scoping in startAndGetDebugSessionCore run for .NET, Node, Rust and Java AppHosts too, not only Go. A live toolbar restart has already been asked for Go. I'd also run one for a C# AppHost before merging, since that is the most-used path. Or, if that isn't practical, scope the watch to Go until #21211 confirms the other languages.
  • Merge order: as the description says, this depends on #18602 landing first. #21193 also edits GoLanguageSupport.cs, but not GetRuntimeSpec, so I don't expect a conflict there.

Two small inline suggestions on parseGoAppHostCommand below.

Comment thread extension/src/debugger/languages/go.ts Resolved
Comment thread extension/src/debugger/languages/go.ts Resolved
The CLI resolves go through PATH/PATHEXT, so on Windows a version-manager shim can arrive as go.cmd or go.bat. parseGoAppHostCommand now strips .exe, .cmd and .bat before comparing the name, so F5 no longer fails with "The Go AppHost launch command was not recognized" while aspire run works. The executable is only name-checked, never launched, so accepting the shim is safe.

The caller resolves the package against the AppHost directory, which is only valid for a relative directory. An import path such as example.com/apphost was forwarded and silently mis-resolved. The parser now returns null unless the package is ".", ".." or starts with either followed by a path separator.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6fc8b4b3-4ff4-421a-9a12-adb6fe10f7de
@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.

🔵 Needs a closer look

The shared restart lifecycle changes still need live Go/Delve validation of relaunch ordering and process cleanup.

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.

David Pine (IEvangelist) added a commit that referenced this pull request Oct 28, 2026
…every resource (#21193)

## Description

A freshly scaffolded Go AppHost had several rough edges: the SDK that
the CLI regenerates under `.aspire/` was not ignored by git,
`apphost.go` was not gofmt-clean, the scaffold output, the `go-starter`
template and the generated SDK files took CRLF line endings on Windows,
the launch profile ports came from a range that overlaps the Windows
dynamic port range, 49 sample AppHosts used a `log.Fatalf` call that `go
vet` rejects, and the starter's `builder.Err()` check could not see a
failed `AddRedis` or `AddGoApp`.

- **Ignore the generated SDK.** `GoLanguageSupport.Scaffold` now also
writes a `.gitignore` containing `.aspire/`, where the CLI regenerates
the SDK (`.aspire/modules`; it is large and rebuilt from the AppHost's
integrations). The `go-starter` template gets the same one-line file,
like the TypeScript, Python and Java starters, and
`TemplateGitIgnoreTests` has a `go-starter` row. In a directory that
already has a `.gitignore`, `ScaffoldingService` keeps it and appends
only the missing entries (`MergeGitIgnoreContent`).
- **gofmt-clean `apphost.go`.** The scaffold listed `"log"` before
`"apphost/modules/aspire"` in one import group, which gofmt reorders,
and ended without a final newline, which gofmt adds (a C# raw string
literal drops the last newline). It now has two import groups and ends
with a newline.
- **LF line endings at the source.** gofmt rewrites a CRLF `.go` file,
and three producers wrote CRLF on Windows. The scaffold's string
literals take the line endings of the C# source (`apphost.go`, `go.mod`,
`apphost.run.json`). The `go-starter` template is embedded and
scaffolded exactly as it is checked out. The generated SDK files
(`go.mod`, `transport.go`, `base.go`, `aspire.go`) mix raw string
literals, `StringWriter` output and embedded resources. `Scaffold` now
converts every file it returns to LF, `GenerateDistributedApplication`
replaces CRLF with LF at its single exit point, and `.gitattributes`
pins `*.go` and the `go-starter` directory to LF. The generator replaces
only `\r\n`: `ReplaceLineEndings` would also split at U+2028, form feed
and NEL, which Go allows inside comments and strings, and the generated
doc comments carry the description text of the exported APIs.
- **Launch profile ports.** `apphost.run.json` drew four ports from
`random.Next(10000, 65000)`, which overlaps the Windows dynamic port
range (49152-65535). It now uses `AppHostProfilePortGenerator`, which
the CLI templates and the TypeScript scaffold already use. Its fixed
ranges all end below 22300 (dashboard 15000-15299 http and 17000-17299
https, OTLP 19000-19299 and 21000-21299, resource service 20000-20299
and 22000-22299). The shared file is linked into the Go code generation
project.
- **Sample AppHosts pass `go vet`.** 408
`log.Fatalf(aspire.FormatError(err))` calls in 49
`tests/PolyglotAppHosts/*/Go/apphost.go` files became
`log.Fatal(aspire.FormatError(err))`. `go vet` reports `non-constant
format string in call to log.Fatalf` for the old form, and a `%` in an
error message would be printed as a formatting verb. The edit is one
token per line with line endings and BOMs unchanged, and no
`Fatalf(aspire.FormatError` remains in the tree.
- **Playground comment.** The example comment in
`playground/GoAppHost/apphost.go` said `AddRedis("cache", nil, nil)`,
which no longer matches the generated signature, where optional
parameters are a trailing options struct. It now says
`AddRedis("cache")`.
- **Check every resource handle.** A child-returning call such as
`AddRedis` or `AddGoApp` that fails records its error on the handle it
returns, not on the builder, and `Build()` checks only the builder's own
error, so the `builder.Err()` check in the template could not see it.
The `go-starter` `apphost.go` now keeps the `api` handle and checks
`Err()` on `cache` and `api` before `Build()`. The `aspire init` example
comment shows the same loop, with `AddRedis` and `AddPostgres`. The
template has no `{{token}}` placeholders, so `aspire new
aspire-go-starter` writes this file as it is, and the `apphost.go` on
the Go AppHost page in microsoft/aspire.dev#1924 is the same text.
- **Tests.** `GoScaffoldTests` (new, 15 test cases) covers the exact
scaffold file set, LF line endings of the scaffold output and of the
`go-starter` files, a `.gitignore` that ignores only `.aspire/`, the
`go.mod` module, go, require and replace directives, the launch profile
ports staying inside the shared generator ranges (five port seeds,
including `null`), language detection on the scaffolded files, and
gofmt-cleanliness of the scaffold output and of the `go-starter` sources
as checked out. `AtsGoCodeGeneratorTests` gets
`GenerateDistributedApplication_WritesFilesWithLfLineEndings`. The Go
code generation test project links every `go-starter` file as a test
input, plus the shared `TemporaryWorkspace` helper. No
`eng/github-ci/test-trigger-map.yml` change is needed:
`tests/PolyglotAppHosts/**` already routes to the polyglot job, the
`go-starter` files are a `None Include` that the project graph sees, and
`.gitattributes` already routes to every target, so this PR selects
every test target. The handle check has no test of its own: nothing pins
the content of the starter `apphost.go` or of the `aspire init` comment,
and `ScaffoldedAndStarterSources_AreGofmtClean` covers their formatting.

Part of #21115

### Not in this PR

- Making the generated SDK (under `.aspire/modules`) gofmt-exact. About
30 emit sites write single-line blocks such as `if x != nil { ... }`,
struct and const alignment differs, and the imports are space-indented,
so `gofmt -l` lists the file. It is git-ignored and regenerated on every
restore, and fixing it means changing those emit sites and re-accepting
every generated-SDK snapshot.
- Running `go vet` over the sample AppHosts in CI.
- The `experimentalPolyglotGo` header comment in
`playground/GoAppHost/apphost.go`, which goes away with the feature flag
(#21106).

## Validation

Commands ran on Windows from the worktree root, on top of
`upstream/main` `5ea175ce62` at head `de7b79d7d2`, with the repo-local
SDK.

| Command | Exit | Result |
| --- | --- | --- |
| `dotnet test --project
tests\Aspire.Hosting.CodeGeneration.Go.Tests\Aspire.Hosting.CodeGeneration.Go.Tests.csproj
--no-restore --no-launch-profile -- --filter-not-trait
"quarantined=true" --filter-not-trait "outerloop=true"` | 0 | 49 passed,
0 failed, 0 skipped |
| `dotnet test --project tests\Aspire.Cli.Tests\Aspire.Cli.Tests.csproj
--no-restore --no-launch-profile -- --filter-class
"*.TemplateGitIgnoreTests" --filter-class "*.NewCommandTests"
--filter-class "*.NewCommandTemplateConfigPersistenceTests"
--filter-class "*.ScaffoldingServiceTests" --filter-not-trait
"quarantined=true" --filter-not-trait "outerloop=true"` | 0 | 165
passed, 0 failed, 0 skipped |
| `git grep -n "Fatalf(aspire.FormatError" HEAD` | 1 | no match (`git
grep` exits 1 when nothing matches) |

The Go run includes all of `GoScaffoldTests`. A `--list-tests` check
showed the Cli run includes the new `go-starter` row of
`TemplateGitIgnoreTests`.

Test-first check for the scaffold LF change: the two new tests
`Scaffold_WritesFilesWithLfLineEndings` and
`ScaffoldedAndStarterSources_AreGofmtClean` were run on their own, in a
CRLF working tree, against the scaffold as it was before the
`ReplaceLineEndings` line was added (the other changes already in
place). Both failed (2 run, 2 failed). The first reported `apphost.go`,
`go.mod` and `apphost.run.json` as containing CR. The second reported
`gofmt -l` listing the scaffolded `apphost.go` with a whole-file diff.
With the change both pass. This also shows that the gofmt test really
runs gofmt when the tools are present. Running `gofmt -d` (Go 1.27.0) on
a minimal file with the previous single import group, and on one without
a final newline, confirms the other two fixes: gofmt moves
`"apphost/modules/aspire"` above `"log"` and adds the missing final
newline.

Test-first check for the starter and generator LF change:
`GoStarterFiles_UseLfLineEndings` and
`GenerateDistributedApplication_WritesFilesWithLfLineEndings` were run
on their own against the source without this change, in a CRLF working
tree. Both failed (2 run, 2 failed). With the change both pass, as part
of the 49 above. Negative control: with the two new `.gitattributes`
rules removed and the starter files re-created,
`GoStarterFiles_UseLfLineEndings` and
`ScaffoldedAndStarterSources_AreGofmtClean` failed again (the second
with a gofmt diff of `go-starter/api/main.go`). With the rules restored
and the files re-created, `git ls-files --eol` lists all 8 starter files
as `i/lf w/lf attr/text eol=lf` and every test passes. The gofmt test
now reads the starter files exactly as they are checked out, without
converting them first.

`ScaffoldedAndStarterSources_AreGofmtClean` is marked
`[RequiresTools(["go", "gofmt"])]`. When a tool is missing the attribute
adds the `category=failing` trait, and the CI test runner filters that
trait out (`eng/Testing.targets`), so the test is left out there rather
than failed. `GeneratedTransport_SupportsDuplexCommunication` in the
same project already works this way with `[RequiresTools(["go"])]`. The
two new LF tests need no external tool and run everywhere.

`go vet` over the 53 sample AppHosts (Go 1.27.0). The first run
generated one SDK from the union of all the samples' packages (80
packages) with a locally built Debug CLI and vetted every sample against
it.

- Before the change: 4 clean, 32 `non-constant format string in call to
log.Fatalf`, 17 type errors.
- After the change: 36 clean, 0 format string failures, the same 17 type
errors.
- The 17 type errors appear only in the shared SDK. Each of those 17 was
vetted again against an SDK generated from only its own packages (in a
scratch copy of `tests/PolyglotAppHosts/<Sample>/Go`: `aspire restore
--non-interactive --apphost apphost.go`, then `go vet ./...`): 17 of 17
clean.
- The scaffolded `apphost.go` with its `go.mod`, and the `go-starter`
AppHost, were vetted the same way and also build with `go build ./...`
(exit 0).

The CLI for these runs was a locally built Debug CLI from an earlier
`main` (`3ed7e9690b`) plus an unrelated Go `aspire docs api` commit, not
a build of this branch's base. The five commits between that `main` and
`5ea175ce62` touch neither the Go or TypeScript code generators, the
shared code generation, the type system, the remote host, nor any Go
sample. These runs also predate the LF commits and the rebase onto
`5ea175ce62`; none of them changes the content of the samples or of the
generated SDK, only its line endings.

Handle check and end-to-end runs (head `de7b79d7d2`). The first checks
used a generated SDK that has `AddRedis`, `AddGoApp` and `AddPostgres`,
from an earlier CLI build (this PR does not touch those APIs or
`Resource.Err()`). The `go-starter` `apphost.go` with its `go.mod`
builds and vets (`go build`, `go vet`, Go 1.27.0, both exit 0) and
`gofmt -l` lists nothing. The `aspire init` example comment, uncommented
in a scratch `main.go` with a `[]aspire.Resource{cache, db}` slice, also
builds and vets, and it is the text of the `Scaffold` raw string with
the comment markers removed (compared as strings). The `apphost.go`
fence on the Go AppHost page in microsoft/aspire.dev#1924 is
byte-identical to the template once line endings are normalized.

Then I built the CLI from this head and ran it on Windows (a Debug build
that targets net11.0, run as `dotnet aspire.dll` with the repo-local
runtime; Go 1.27.0 with `GOTOOLCHAIN=local`, `GOWORK=off` and
`GOPROXY=off`). The Go starter is still behind
`features__experimentalPolyglotGo` until #21106 lands, so I set it.
`aspire new` needed `--version 17.0.0-dev`: without it the CLI looks for
a local `Aspire.ProjectTemplates` package of its own version and finds
none.

- `aspire new aspire-go-starter --version 17.0.0-dev --name verifygo
--non-interactive --suppress-agent-init` exited 0. The `apphost.go` it
wrote is byte-identical to the template (1224 bytes, LF only, no BOM),
`.gitignore` is exactly `.aspire/`, and all 8 starter files have no CR.
In that project `gofmt -l` lists nothing, and `go build ./...` and `go
vet ./...` exit 0 against the SDK the command generated.
- `aspire init --language go` in an empty directory exited 0 and wrote
`.gitignore` (`.aspire/`), `apphost.go` with the new handle-loop
comment, `go.mod` and `aspire.config.json`. The Go files and
`.gitignore` have no CR and no BOM, `gofmt -l` lists nothing, and `go
build ./...` and `go vet ./...` exit 0. `aspire.config.json` has CRLF on
Windows because `AspireConfigFile.Save` uses the platform newline for
every language; this PR does not change that.
- A failed `Add` call at run time. In a copy of the starter I renamed
the Go app to `"cache"`, the name of the Redis resource, so `AddGoApp`
fails on the server (`Cannot add resource of type
'Aspire.Hosting.Go.GoAppResource' with name 'cache' because resource of
type 'Aspire.Hosting.ApplicationModel.RedisResource' with that name
already exists`). With the new loop, `aspire run --apphost apphost.go
--isolated --non-interactive` stopped before `Run()`, printed that
message and `exit status 1`, and the CLI reported `The Go apphost
failed`. In a second copy that skipped the loop and wrote the results to
a file, `builder.Err()` was nil, `cache.Err()` was nil, `api.Err()` held
that message and `Build()` returned nil, so a check of `builder.Err()`
alone does not see the failure.

Overlap with open PRs: this PR shares files with #21183
(`playground/GoAppHost/apphost.go`), #21187 (`GoLanguageSupport.cs`),
#21188 (`AtsGoCodeGenerator.cs`, `AtsGoCodeGeneratorTests.cs`), #21194
(`AtsGoCodeGeneratorTests.cs`), #21195 and #21197
(`AtsGoCodeGenerator.cs`, `Aspire.Hosting.CodeGeneration.Go.csproj`) and
#21199 (`AtsGoCodeGenerator.cs`). A trial merge (`git merge-tree
--write-tree`) of this head with the head of each of those seven PRs
(`0e65752d44`, `e1bb4c11ae`, `9088dfe7fb`, `ffc59f2023`, `7d33810c11`,
`82a44b0723`, `4f5a7a84aa`) was clean, as was a trial merge with each of
the other open Go AppHost PRs and with `upstream/main` `f4ae2cc424`.

Not run:

- `aspire init --language go` in a directory that already has a
`.gitignore` or a `go.mod`. The run above used an empty directory. The
`.gitignore` merge has two unit tests
(`MergeGitIgnoreContent_AppendsMissingEntriesWithoutOverwritingExistingContent`
and
`MergeGitIgnoreContent_DoesNotAddDuplicateAspireEntryWhenEquivalentEntryAlreadyExists`).
- The LF changes are observable only on CRLF inputs. On a Linux or macOS
checkout the LF tests pass with or without them, and I ran on Windows
only. A working tree checked out before the `.gitattributes` rule keeps
CRLF in the `go-starter` files, because git does not rewrite existing
files when an attribute changes, so `GoStarterFiles_UseLfLineEndings`
fails there until the files are re-created (delete the `go-starter`
directory and run `git checkout -- <directory>`). Fresh checkouts are
not affected. Whether the official build checks the `go-starter` files
out as LF or CRLF was not checked; the rule makes it LF either way.
- The rest of `Aspire.Cli.Tests`, the CLI end-to-end tests, and the
polyglot validation scripts under
`.github/workflows/polyglot-validation`. `test-go.sh` there scaffolds
with `aspire init --language go` and inserts code before the
`builder.Build()` line; the scaffold keeps that line and both imports.
- `go vet` over the 53 sample AppHosts with a CLI built from this head.
Only the starter and the `aspire init` scaffold were run with it.
- The output of the 36-sample union SDK vet run was not saved to a file,
so only the per-sample runs above can be repeated from the description.

## Checklist

- Is this feature complete?
  - [x] Yes. Ready to ship.
  - [ ] 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 <7679720+IEvangelist@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
Brings in the VS Code resource attach work from #18602 and resolves the three
files that both sides changed:

- extension/README.md: "Debug across your stack" keeps the Go AppHost sentence,
  followed by the "Attach to running resources" bullet.
- extension/src/debugger/languages/go.ts: Go AppHost command parsing and the Go
  resource attach providers sit side by side. They are independent code paths;
  the AppHost parser also accepts go.cmd and go.bat shims.
- extension/src/test/goDebugger.test.ts: imports are the union of both sides.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6fc8b4b3-4ff4-421a-9a12-adb6fe10f7de
@github-actions

Copy link
Copy Markdown
Contributor

Tests selector

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

Selected PR test projects (4 / 100)

Aspire.Cli.EndToEnd.Tests, Aspire.Cli.Tests, Aspire.Hosting.CodeGeneration.Go.Tests, Aspire.Hosting.RemoteHost.Tests

Selected PR jobs (4)

extension-e2e, extension-unit, polyglot, typescript-api-compat


How these were chosen — grouped by what changed

🔧 src/Aspire.Hosting.CodeGeneration.Go/GoLanguageSupport.cs (changed source)
→ 2 directly: Aspire.Cli.Tests, Aspire.Hosting.CodeGeneration.Go.Tests
→ 1 via the project graph: Aspire.Hosting.RemoteHost.Tests

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

🧪 tests/Aspire.Hosting.CodeGeneration.Go.Tests/GoLanguageSupportTests.cs (changed test)
→ 1 directly: Aspire.Hosting.CodeGeneration.Go.Tests

Job reasons

Job Triggered by
extension-e2e extension/loc/xlf/aspire-vscode.xlf, extension/package.json, extension/package.nls.json, extension/src/capabilities.ts, extension/src/debugger/AspireDebugSession.ts, extension/src/debugger/adapterTracker.ts, extension/src/debugger/languages/go.ts, extension/src/loc/strings.ts, extension/src/services/launchFailureStore.ts, extension/src/test-e2e/packageSurface.e2e.test.ts, extension/src/test/adapterTracker.test.ts, extension/src/test/appHostDiscovery.test.ts, extension/src/test/appHostLanguage.test.ts, extension/src/test/aspireDebugSession.test.ts, extension/src/test/goDebugger.test.ts, extension/src/test/launchFailureStore.test.ts, extension/src/test/packageManifest.test.ts, extension/src/test/strings.test.ts, extension/src/utils/appHostDiscovery.ts, extension/src/utils/appHostLanguage.ts
extension-unit extension/loc/xlf/aspire-vscode.xlf, extension/package.json, extension/package.nls.json, extension/src/capabilities.ts, extension/src/debugger/AspireDebugSession.ts, extension/src/debugger/adapterTracker.ts, extension/src/debugger/languages/go.ts, extension/src/loc/strings.ts, extension/src/services/launchFailureStore.ts, extension/src/test-e2e/packageSurface.e2e.test.ts, extension/src/test/adapterTracker.test.ts, extension/src/test/appHostDiscovery.test.ts, extension/src/test/appHostLanguage.test.ts, extension/src/test/aspireDebugSession.test.ts, extension/src/test/goDebugger.test.ts, extension/src/test/launchFailureStore.test.ts, extension/src/test/packageManifest.test.ts, extension/src/test/strings.test.ts, extension/src/utils/appHostDiscovery.ts, extension/src/utils/appHostLanguage.ts
polyglot affected project Aspire.Hosting.CodeGeneration.Go
typescript-api-compat affected project Aspire.Hosting.CodeGeneration.Go

Selection computed for commit b4177e3.

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.

🔵 Needs a closer look

The shared AppHost restart lifecycle depends on VS Code/Delve event timing, and synthetic tests alone cannot confirm correct restart ordering and child-process cleanup without live Go session validation.

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) merged commit c1b1f94 into main Oct 30, 2026
422 of 426 checks passed
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 17.0 milestone Oct 30, 2026
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

Pull request created: #1982

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

@aspire-repo-bot

Copy link
Copy Markdown
Contributor

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

Updated get-started/aspire-vscode-extension.mdx with a Go language-coverage row and Go AppHost run/debug notes. Signals: polyglot_code_generator_changed (GoLanguageSupport.cs), pr_body_has_cli_flag_mention (PR body go run flags).

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 <7679720+IEvangelist@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c8717a87-0ee5-4296-a6fd-ea6e2d91a57e
David Pine (IEvangelist) added a commit that referenced this pull request Nov 6, 2026
## Description

Adds Go AppHost resource parsing for CodeLens and gutter indicators, and
offers the existing debugger setup flow before debugging a Go, Java, or
Rust AppHost with missing debugger extensions. Selecting Set Up or
dismissing the prompt cancels this launch without a duplicate
launch-failure notification/history entry. Run Without Debugging remains
available.

Nested and parenthesized Go resource expressions retain their
declaration's CodeLens/gutter anchor. The README documents that
golang.go's toolchain settings govern the debugger, while Aspire CLI
resolves Go from its environment.

Adds Go AppHost-and-resource source-breakpoint coverage to the existing
resource-debug E2E shard. Generated AppHosts require Go 1.26, but the
old Delve v1.25.2 rejects that toolchain. Provisioning now selects Go
1.26.10 and Delve v1.27.2 without disabling compatibility checks or
changing action pins. Go code-generation changes select extension E2E
through both affected-project and path-fallback routing.

Relates to #21201, #21213, #21114, and #21115. Builds on already-merged
#21187 and #18602. #21211 remains open for live restart validation;
restart lifecycle/policy changes are intentionally deferred.

### Validation

**Latest head `ccded4f4cf`: actual CI logs inspected, not just job
conclusions.**

| Scenario | Linux | Windows |
| --- | --- | --- |
| Public Debug-command dismissal of missing Go debugger; no duplicate
error, session/process, pending launch, or installer invocation |
[Passed; tree-actions
7/7](https://github.com/microsoft/aspire/actions/runs/42153424399/job/127689898330)
| [Passed; tree-actions
7/7](https://github.com/microsoft/aspire/actions/runs/42153424399/job/127689898437)
|
| Next multi-root action-routing scenario after temporary Go fixture
cleanup | Passed in the same shard | Passed in the same shard |
| Real source breakpoints in both Go AppHost and Go resource using
packaged Delve | [Passed, 19.488 seconds; shard 4 passing / 4
pending](https://github.com/microsoft/aspire/actions/runs/42153424399/job/127689898350)
| [Passed, 26.818 seconds; shard 5 passing / 3
pending](https://github.com/microsoft/aspire/actions/runs/42153424399/job/127689898325)
|
| Full extension unit suite | See PR checks | [4151 passing / 9
pending](https://github.com/microsoft/aspire/actions/runs/42153424399/job/127682946315)
|

All four E2E jobs had an empty advisory-issue setting; these were not
masked failures. Both resource-debug shards also cover existing Go
resource attach/Run Without Debugging attach behavior. The prior
`6be2b99a45` Go breakpoint scenario also passed on
[Linux](https://github.com/microsoft/aspire/actions/runs/42116516011/job/127565932765)
and
[Windows](https://github.com/microsoft/aspire/actions/runs/42116516011/job/127565933063).
These results supersede the original unverified-breakpoint statement.

The first dismissal E2E revision passed its new scenario on both
platforms but failed the next existing multi-root scenario: deleting the
temporary Go fixture left its repository selection stale. `ccded4f4cf`
refreshes discovery and waits for the primary selection during teardown.
Latest-head CI above confirms both consecutive scenarios pass.

First added failing regressions reproducing both reviewer findings
(nested calls anchored to line 0; setup/dismissal produced
`StartDebuggingDeclined`). After fixes, these commands passed from
`extension`:

```powershell
corepack yarn compile-tests
corepack yarn lint
corepack yarn compile
corepack yarn unit-test --run out/test/goAppHostParser.test.js --run out/test/aspireCodeLensProvider.test.js --run out/test/appHostLaunchService.test.js --run out/test/appHostTreeView.test.js --run out/test/aspireDebugConfigurationProvider.test.js --run out/test/aspireDebugSession.test.js --run out/test/rpc/interactionServiceTests.test.js --timeout 120000
```

The focused suite passed **833 tests / 2 pending**. It covers the
registered public Debug-command callback through the real tree, launch
service, and resolver for setup and dismissal, with substituted
language-extension lookup, notifications, debugger start, and installer.
Assertions cover cancellation telemetry, no duplicate
notification/failure-history entry, cleared state, and preserved genuine
declined-launch errors after cancellation/token reuse.
Parser/lens/gutter coverage includes nested/parenthesized calls and
indexed receivers. Bundling passed with the same four pre-existing
webpack dependency warnings.

For the fixture-cleanup revision, compile-tests and lint passed again;
this command passed **463 tests / 2 pending**:

```powershell
corepack yarn unit-test --run out/test/appHostLaunchService.test.js --run out/test/appHostTreeView.test.js --run out/test/cliSpawn.test.js --timeout 120000
```

**Earlier failures disclosed:** initial Windows CI on `4285826199` had
4149 passing / 9 pending / 2 failing global fake-timer-count assertions
in unchanged POSIX cleanup tests. An independently initiated same-head
[rerun](https://github.com/microsoft/aspire/actions/runs/42149372040/job/127679739644)
passed 4151 / 9 pending; latest-head CI also passes all 4151. No
process-lifecycle/timer-policy changes were made. A full local Windows
`corepack yarn unit-test --timeout 120000` had 4149 passing / 9 pending
/ 2 failing unchanged download-cache file-identity/symlink timestamp
assertions; it is not claimed green.

Earlier extension commands also passed:

```powershell
corepack yarn generate-schema
corepack yarn unit-test --run out/test/goAppHostParser.test.js --run out/test/parsers.test.js --run out/test/aspireCodeLensProvider.test.js --run out/test/aspireDebugConfigurationProvider.test.js --run out/test/goDebugger.test.js --run out/test/debuggerInstallHints.test.js --run out/test/strings.test.js
corepack yarn unit-test --run out/test/e2eLaunchProfile.test.js --run out/test/aspireDebugSession.test.js --timeout 120000
```

The focused commands passed **392** and **318** tests respectively. The
second initially had 317 passing / 1 timeout at the default 20-second
budget; the explicit slow-host budget passed all 318. Schema generation
passed with the current source-built CLI and pinned SDK; unrelated
generated drift is excluded.

Repository-root commands:

```powershell
dotnet build src\Aspire.Cli\Aspire.Cli.csproj --nologo --verbosity quiet
dotnet test --project tests\Infrastructure.Tests\Infrastructure.Tests.csproj --no-launch-profile -- --filter-class 'Infrastructure.Tests.TestTriggerMap.TestTriggerMapTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'
git diff --check
```

CLI build passed with a NU1903 advisory for the pinned ILCompiler
dependency; real-map tests passed **175/175**; whitespace checks passed.
A broader selector namespace run was **not green: 355 passed / 22
failed**, including Windows selecting WSL's shim with no `/bin/bash` and
access-denied temporary Git cleanup. The comparison-base script/tests
are unchanged from `origin/main`, and direct execution of the system
Bash shim reproduces the missing-shell error.

An isolated Docker control with Go 1.26.10 reproduced the old Delve
compatibility failure, then installed v1.27.2 and hit a real `main.main`
source breakpoint.

**Remaining live limitations:** actual Marketplace installation,
missing-Delve UX, and toolbar/keybinding restart across adapters.
Successful setup uses a substituted installer in integration coverage
rather than contacting Marketplace from offline E2E. No local
interactive Go session/screenshots were captured. The installed old
Aspire CLI was not used as current-product evidence. Adjacent Python
classification, Node/Bun/Deno display-name localization, and
download-cache behavior remain outside this PR. Mitch's approved,
explicitly non-blocking tree-sitter-go suggestion is a separate
follow-up; this PR does not replace its parser or modify dependency
manifests for that exploration.

### Screenshots / Recordings

> **This PR includes UI changes.** Please add screenshots or screen
recordings so reviewers can evaluate the visual changes without running
locally.
>
> - For before/after comparisons, place them side-by-side or label them
clearly.
> - For interactive changes (animations, transitions, new flows), prefer
a short screen recording (GIF or video).
> - If you cannot capture visuals now, note what scenario to test and
mark this section as TODO.

TODO: capture Go resource CodeLens/gutter indicators and the
missing-debugger Set Up prompt. Real Linux/Windows CI verifies
breakpoints, running CodeLens, and prompt dismissal, but no local
interactive screenshot was captured.

<!-- Add screenshots/recordings here -->

## 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: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sébastien Ros (sebastienros) added a commit to microsoft/aspire.dev that referenced this pull request Nov 14, 2026
Documents changes from microsoft/aspire#21187 by ``@sebastienros``'s
reviewed PR author (see source PR).

**Target branch:** Targeting `release/17.0` — the latest release branch
on `microsoft/aspire.dev` — because the source PR has no milestone or
`release/*` base ref to derive a more specific target.

**Why:** The source PR lets the VS Code extension launch and debug Go
AppHosts (`apphost.go`) via the Go extension's Delve adapter. Triggered
signals: `polyglot_code_generator_changed` (`GoLanguageSupport.cs`) and
`pr_body_has_cli_flag_mention` (`go run` flags in the PR body).

**Changes (1 page updated):**
-
`src/frontend/src/content/docs/get-started/aspire-vscode-extension.mdx`:
added a Go row to the language coverage table and a note on Go AppHost
run/debug, supported `go run <package>` commands, error behavior, and
toolbar restart.

> Generated by [PR Documentation
Check](https://github.com/microsoft/aspire/actions/runs/40991706386) for
#21187 · copilot · auto · 26.6 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: 40991706386, workflow_id: pr-docs-check, run:
https://github.com/microsoft/aspire/actions/runs/40991706386 -->

<!-- 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: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Sébastien Ros <1165805+sebastienros@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants