Skip to content

fix: run goreleaser tidy hook through shell - #2

Merged
intel352 merged 2 commits into
masterfrom
fix/goreleaser-before-hook
Apr 27, 2026
Merged

intel352 merged 2 commits into
masterfrom
fix/goreleaser-before-hook

Conversation

@intel352

Copy link
Copy Markdown
Contributor

Summary

  • wraps the GoReleaser GOWORK=off tidy hook in sh -c
  • fixes failed v1.0.0 release where GoReleaser tried to execute GOWORK=off as a binary

Verification

  • GOWORK=off go mod tidy -diff
  • GOWORK=off go test ./... -count=1
  • git diff --check

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes the GoReleaser before.hooks tidy step so it runs correctly by invoking the GOWORK=off go mod tidy command through a shell, avoiding GoReleaser attempting to execute GOWORK=off as a binary during release automation.

Changes:

  • Wrap GOWORK=off go mod tidy in sh -c within .goreleaser.yml before.hooks so the environment assignment is handled by a shell.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@intel352
intel352 requested a review from Copilot April 27, 2026 21:00
@intel352
intel352 merged commit 80504d9 into master Apr 27, 2026
7 checks passed
@intel352
intel352 deleted the fix/goreleaser-before-hook branch April 27, 2026 21:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .goreleaser.yml
- GOWORK=off go mod tidy
- "sed -i.bak -e 's/\"version\": \".*\"/\"version\": \"{{ .Version }}\"/' -e 's#/releases/download/v[^/]*/#/releases/download/v{{ .Version }}/#g' plugin.json && rm -f plugin.json.bak"
- sh -c "GOWORK=off go mod tidy"
- sh -c "sed -i.bak -e 's/\"version\": \".*\"/\"version\": \"{{ .Version }}\"/' -e 's#/releases/download/v[^/]*/#/releases/download/v{{ .Version }}/#g' plugin.json && rm -f plugin.json.bak"

Copilot AI Apr 27, 2026

Copy link

Choose a reason for hiding this comment

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

PR description says only the GOWORK=off go mod tidy hook is wrapped in sh -c, but this change also wraps the sed ... plugin.json hook. If this is intentional, please update the PR description (or revert this line) so the change scope is clear for reviewers/release notes.

Copilot uses AI. Check for mistakes.
Comment thread .goreleaser.yml
- GOWORK=off go mod tidy
- "sed -i.bak -e 's/\"version\": \".*\"/\"version\": \"{{ .Version }}\"/' -e 's#/releases/download/v[^/]*/#/releases/download/v{{ .Version }}/#g' plugin.json && rm -f plugin.json.bak"
- sh -c "GOWORK=off go mod tidy"
- sh -c "sed -i.bak -e 's/\"version\": \".*\"/\"version\": \"{{ .Version }}\"/' -e 's#/releases/download/v[^/]*/#/releases/download/v{{ .Version }}/#g' plugin.json && rm -f plugin.json.bak"

Copilot AI Apr 27, 2026

Copy link

Choose a reason for hiding this comment

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

The sh -c "sed ..." hook now has multiple layers of quoting/escaping, which is easy to break when editing (and can be YAML-parsing sensitive around : sequences). Consider quoting the entire hook as a single YAML string (e.g., a single-quoted scalar or a |- block) and using single quotes for the sh -c argument to reduce escaping and make future edits safer.

Suggested change
- sh -c "sed -i.bak -e 's/\"version\": \".*\"/\"version\": \"{{ .Version }}\"/' -e 's#/releases/download/v[^/]*/#/releases/download/v{{ .Version }}/#g' plugin.json && rm -f plugin.json.bak"
- 'sh -c ''sed -i.bak -e '"'"'s/"version": ".*"/"version": "{{ .Version }}"/'"'"' -e '"'"'s#/releases/download/v[^/]*/#/releases/download/v{{ .Version }}/#g'"'"' plugin.json && rm -f plugin.json.bak'''

Copilot uses AI. Check for mistakes.
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.

2 participants