Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 4, 2025

Adds support for running go mod tidy or go mod download before a Golang application starts, following the pattern established by Bun/Deno integrations.

Changes

  • GoModInstallerResource: New resource type extending ExecutableResource for the Go module installer
  • WithGoModTidy(): Runs go mod tidy to clean up and verify dependencies before app start
  • WithGoModDownload(): Runs go mod download to download dependencies before app start
  • Both methods only execute in development mode, create a parent-child relationship in the dashboard, and support optional installer configuration

Usage

var golang = builder.AddGolangApp("golang", "../gin-api")
    .WithGoModTidy()
    .WithHttpEndpoint(env: "PORT");

// Or with customization
var golang = builder.AddGolangApp("golang", "../gin-api")
    .WithGoModDownload(installer => 
        installer.WithEnvironment("GOPROXY", "https://proxy.golang.org,direct"))
    .WithHttpEndpoint(env: "PORT");

Based on the approach suggested in davidfowl/aspire-13-samples.

Original prompt

This section details on the original issue you should resolve

<issue_title>go mod tidy/go download</issue_title>
<issue_description>### Related to an existing integration?

Yes

Existing integration

Golang

Overview

We could add go mod tidy/go downlaod to our golang integration. @davidfowl suggested a possible implementation here: https://github.com/davidfowl/aspire-13-samples/blob/731a43a848706cf0bbcece1506122e5b6c19f2d8/golang-api/apphost.cs#L53-L61

Usage example

The api is internal to the golang resource.

Breaking change?

No

Alternatives

Manually run by user.

Additional context

No response

Help us help you

Yes, I'd like to be assigned to work on this item</issue_description>

Comments on the Issue (you are @copilot in this section)

Custom agent used: Hosting Integration Creator
This agent helps users create new hosting integration in Aspire by scaffolding the correct projects and files based on user input.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Dec 4, 2025
Copilot AI changed the title [WIP] Add go mod tidy and go download to golang integration Add WithGoModTidy and WithGoModDownload for Golang integration Dec 4, 2025
Copilot AI requested a review from aaronpowell December 4, 2025 05:40
@davidfowl
Copy link
Contributor

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 install: true means

@tommasodotNET
Copy link
Contributor

tommasodotNET commented Dec 4, 2025

@aaronpowell
Copy link
Member

oh wait, IIRC there was a new installer base stack coming wasn't there @davidfowl ?

@github-actions github-actions bot added the Stale label Dec 10, 2025
@aaronpowell aaronpowell added this to the 13.1 milestone Dec 11, 2025
@github-actions github-actions bot added Stale and removed Stale labels Dec 11, 2025
@github-actions github-actions bot closed this Dec 19, 2025
@tommasodotNET tommasodotNET reopened this Dec 19, 2025
@github-actions github-actions bot removed the Stale label Dec 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

go mod tidy/go download

4 participants