Skip to content

Support build tags for Go programs #730

@mfcollins3

Description

@mfcollins3

Related to an existing integration?

Yes

Existing integration

Golang

Overview

I am using Aspire to run a Go program that serves a Vue.js application and implements the API for the Vue.js application. I am using the embed package to embed the static Vue.js files into my Go application and then using the FileServeFS function to serve the files from the embedded file system.

When running my service with Aspire, instead of serving from the static file system, I would like to run the Vue.js development server as a child process and use Go's ReverseProxy to forward the requests to the NPM development server. By doing this, during development and testing, I can make changes to my Vue.js application and the changes can be rebuilt and served without me having to stop and restart everything.

I am implementing this in my Go program using Go's build tags. In my case, I am using the dev build tag to indicate that I want to run the development server instead of embedding the static files in the program.

Currently, there is no way to send a build tag to the go run command that GolangAppHostingExtension executes. The optional args is used to pass command line arguments to the Go program that iss being executed. I would like to extend the GolangAppHostingExtension.AddGolangApp method to add an optional buildTags string array. If present, the tags would be joined into a comma-separated list and passed to the go run command using the -tags command line argument.

Usage example

var builder = DistributedApplication.CreateBuilder(args);

builder.AddGolangApp("web", "../../web", buildTags: ["dev"])

Breaking change?

No

Alternatives

I am not aware of any alternative approaches.

Additional context

No response

Help us help you

Yes, I'd like to be assigned to work on this item

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions