Add WithGoModTidy and WithGoModDownload for Golang integration#1031
Conversation
…integration Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
|
We use the same installer resource and swap out the command. See npm and python. We've also made some changes to how it works with respect to what |
do you mean these classes? |
|
oh wait, IIRC there was a new installer base stack coming wasn't there @davidfowl ? |
tommasodotNET
left a comment
There was a problem hiding this comment.
@copilot on top of my comment, we also want to add the install flag on the mod extension:When true (default), automatically installs packages before the application starts. When false, only sets the package manager annotation without creating an installer resource.
see here an implementation example
https://raw.githubusercontent.com/dotnet/aspire/refs/heads/main/src/Aspire.Hosting.JavaScript/JavaScriptHostingExtensions.cs
…of IsPublishMode Co-authored-by: tommasodotNET <12819039+tommasodotNET@users.noreply.github.com>
Added the |
…ationTests.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ationTests.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ationTests.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…n assertions, remove unused variables Co-authored-by: tommasodotNET <12819039+tommasodotNET@users.noreply.github.com>
Minimum allowed line rate is |
GoModInstallerResourceclass (similar toBunInstallerResource)WithGoModTidy()extension method to rungo mod tidybefore app startsWithGoModDownload()extension method to rungo mod downloadbefore app startsinstallparameter (defaulttrue) to control installer execution!IsPublishModetoIsRunModeper review feedbackSummary
This PR adds support for running
go mod tidyorgo mod downloadbefore a Golang application starts in the Aspire Golang integration, following the JavaScript hosting pattern.Changes Made
New Files
src/CommunityToolkit.Aspire.Hosting.Golang/GoModInstallerResource.cs- New resource type for the Go module installerModified Files
src/CommunityToolkit.Aspire.Hosting.Golang/GolangAppHostingExtension.cs- AddedWithGoModTidy()andWithGoModDownload()extension methods withinstallparametersrc/CommunityToolkit.Aspire.Hosting.Golang/README.md- Added documentation for the new dependency management featurestests/CommunityToolkit.Aspire.Hosting.Golang.Tests/ResourceCreationTests.cs- Added 11 tests for the new methodsKey Behavior
The implementation follows the JavaScript hosting pattern:
install: true(default): The Go app waits for installer completion before starting (verified by WaitAnnotation)install: false: Installer is created withWithExplicitStart()- visible in dashboard but requires manual startUsage
Review Feedback Addressed
!IsPublishModetoIsRunMode(comment #2693376853)installparameter with defaulttrue(comment #3664371891)WithExplicitStart()wheninstall: falseper JavaScript hosting patternGetArgumentValuesAsync()withGetArgumentListAsync()(comment #2693542533)golangResourcevariable assignments (comments #2693542562, #2693542631, #2693542648)Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.