Repository navigation
fix: run goreleaser tidy hook through shell - #2
Conversation
There was a problem hiding this comment.
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 tidyinsh -cwithin.goreleaser.ymlbefore.hooksso the environment assignment is handled by a shell.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
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.
| - 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" |
There was a problem hiding this comment.
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.
| - 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" |
There was a problem hiding this comment.
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.
| - 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''' |
Summary
Verification