fix: correct ldflags quoting in release workflow#3
Merged
Conversation
The release workflow was passing `-ldflags '-X ...'` via `go_build_options`,
which gets set as the `GO_BUILD_OPTIONS` environment variable. In
`build_and_release.sh`, this variable is expanded unquoted (`${GO_BUILD_OPTIONS}`),
so bash word-splits it on spaces. Single quotes inside an unquoted variable
expansion are literal characters, not shell quotes - causing `'-X` (with the
literal quote character) to be passed as the value for `-ldflags`, which is
invalid.
Fix: use `-ldflags=-X=path.Var=value` (no spaces, single token) so bash word
splitting produces exactly one argument. The `=` syntax is supported by both
the Go build tool (for `-ldflags`) and the Go linker (for `-X`).
Co-authored-by: skarim <1701557+skarim@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-stack/sessions/7f8aece9-d05c-478e-8864-ff0b5e00b3a8
Copilot
AI
changed the title
[WIP] Fix the failing GitHub Actions workflow release
fix: correct ldflags quoting in release workflow
Mar 25, 2026
skarim
approved these changes
Mar 25, 2026
There was a problem hiding this comment.
Pull request overview
Updates the GitHub release workflow to pass Go linker flags in a space-free form, ensuring the cmd.Version variable is injected reliably during extension precompilation.
Changes:
- Adjust
go_build_optionsto use-ldflags=-X=...format (no embedded spaces/quotes) when settinggithub.com/github/gh-stack/cmd.Version.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Warning This is an internal experiment to assess Copilot's ability to auto-approve PRs. Please 👍 this comment if the assessment below is correct and 👎 if not. Feedback in #f-ccr-auto-approve is appreciated! Copilot thinks this PR is ready to approve and merge. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The release workflow was failing because
go_build_optionsused single quotes around the-Xflag value. Thecli/gh-extension-precompile@v2action expands${GO_BUILD_OPTIONS}unquoted inbuild_and_release.sh, so single quotes become literal characters rather than shell quotes — bash word-splits the value and passes'-Xas the-ldflagsargument, which Go rejects.Change
Replaced quoted space-separated form with
=-only syntax, producing a single whitespace-free token that survives unquoted expansion:Both
=forms are standard:-ldflags=VALUEis Go flag package syntax;-X=importpath.name=valueis valid linker syntax. Go also concatenates multiple-ldflagsarguments, so the existing-s -win the build script is preserved.Original prompt
⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.