Skip to content

Fix unwanted spaces in GoReleaser archive names #14

@iiAtlas

Description

@iiAtlas

Problem

GoReleaser is creating archive filenames with unwanted spaces after the hyphen:

  • mdv- tui_v1.0.0_linux_x86_64.tar.gz (should be mdv-tui_...)
  • mdv- gui_v1.0.0_darwin_arm64.tar.gz (should be mdv-gui_...)

Root Cause

In .goreleaser.yaml, the name_template uses YAML's >- folding syntax incorrectly:

name_template: >-
  {{ .ProjectName }}-
  tui_
  {{- .Version }}_

The >- folds newlines into spaces, so this becomes:

{{ .ProjectName }}- tui_
                   ↑ unwanted space here!

Solution

Put the suffix on the same line as the hyphen, like the mdv-mac-archive already does correctly:

File: .goreleaser.yaml

Fix mdv-tui-archive (lines 78-87)

- id: mdv-tui-archive
  ids:
    - mdv-cross
  name_template: >-
    {{ .ProjectName }}-tui_
    {{- .Version }}_
    {{- .Os }}_
    {{- if eq .Arch "amd64" }}x86_64
    {{- else }}{{ .Arch }}{{ end }}

Fix mdv-gui-archive (lines 96-105)

- id: mdv-gui-archive
  ids:
    - mdv-darwin
  name_template: >-
    {{ .ProjectName }}-gui_
    {{- .Version }}_
    {{- .Os }}_
    {{- if eq .Arch "amd64" }}x86_64
    {{- else }}{{ .Arch }}{{ end }}

Expected Result

After fix:

  • mdv-tui_v1.0.0_linux_x86_64.tar.gz
  • mdv-gui_v1.0.0_darwin_arm64.tar.gz

References

  • Lines 78-87: mdv-tui-archive name template
  • Lines 96-105: mdv-gui-archive name template
  • Lines 61-69: mdv-mac-archive (correct example)

Impact

  • 🐛 Cosmetic issue only - doesn't affect functionality
  • 📦 Affects all GoReleaser-created archives
  • 🏷️ Makes asset names look unprofessional in GitHub Releases

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions