Skip to content

Add Go Build Tags Support #733

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 17, 2025

Conversation

mfcollins3
Copy link
Contributor

@mfcollins3 mfcollins3 commented Jun 16, 2025

Closes #730

I updated GolangAppHostingExtension to support specifying Go build tags to be used when building and running Go applications. Go build tags can be used to include or exclude files from the build process based On specific conditions. For example, when using Aspire for development, a Go developer may use a build tag to enable special code for OpenTelemetry instrumentation or enable debugging features.

I created a unit test to verify that the build tag was being passed in the command line to the go command.

PR Checklist

  • Created a feature/dev branch in your fork (vs. submitting directly from a commit on main)
  • Based off latest main branch of toolkit
  • PR doesn't include merge commits (always rebase on top of our main, if needed)
  • New integration
    • Docs are written
    • Added description of major feature to project description for NuGet package (4000 total character limit, so don't push entire description over that)
  • Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Contains NO breaking changes
  • Every new API (including internal ones) has full XML docs
  • Code follows all style conventions

Other information

I accomplished my change by adding a new argument to the GolangAppHostingExtension.AddGolangApp method, but the new argument is marked as optional and has a default null value. This should not break existing consumers of the AddGolandApp method or make them alter how they call AddGolangApp in their code.

I updated GolangAppHostingExtension to support specifying Go build tags
to be used when building and running Go applications. Go build tags can
be used to include or exclude files from the build process based On
specific conditions. For example, when using Aspire for development, a
Go developer may use a build tag to enable special code for
OpenTelemetry instrumentation or enable debugging features.

Closes CommunityToolkit#730
I revised the way that I was building the command line for the `go run`
command based on review recommendations. The new approach should improve
readability of the code.
Copy link
Contributor

@tommasodotNET tommasodotNET left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for this contribution!

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.

Support build tags for Go programs
3 participants