hashicorp / go-getter

Package for downloading things from a string URL using a variety of protocols.
Mozilla Public License 2.0
1.65k stars 232 forks source link

request: consider releasing `tar.gz` archives for non-Windows systems #448

Open hhromic opened 1 year ago

hhromic commented 1 year ago

First of all, thanks for this very useful tool. 💯

I noticed that the release artifacts for go-getter are formatted as ZIP files (for example for 1.7.2):

go-getter_1.7.2_darwin_amd64.zip
go-getter_1.7.2_linux_386.zip
go-getter_1.7.2_linux_amd64.zip
go-getter_1.7.2_windows_386.zip
go-getter_1.7.2_windows_amd64.zip

While ZIP is a widely known and used archiving format, it is not very convenient in non-Windows systems where the unzip command may not even be installed by default. For systems such as Linux and macOS, the defacto standard archiving tool is tar and for compression is gzip or even bzip2. For this reason, many software archives are usually distributed in tar.gz or tar.bz2 formats.

Would go-getter consider releasing archives in tar.gz (more widely used) or tar.bz2 formats for Linux and macOS?

This is actually very easy to accomplish with goreleaser, which is the releasing tool seemingly used in this repository.

Currently, go-getter uses the following goreleaser configuration which generates the ZIP files for everything:

archives:
  - format: zip
    name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
    files: 
      - none*

From the official documentation of goreleaser it can be seen that using tar.gz for non-Windows and ZIP for Windows systems is rather trivial and even documented as a common use case:

archives:
    # Archive format. Valid options are `tar.gz`, `tgz`, `tar.xz`, `txz`, tar`, `gz`, `zip` and `binary`.
    # If format is `binary`, no archives are created and the binaries are instead
    # uploaded directly.
    #
    # Default: 'tar.gz'
    format: tar.gz

    # Can be used to change the archive formats for specific GOOSs.
    # Most common use case is to archive as zip on Windows.
    format_overrides:
      - goos: windows
        format: zip

    # The rest used by go-getter
    name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
    files: 
      - none*

With non-Windows releases in tar.gz format, this pattern can be used for installing go-getter for example inside a container:

mkdir -p /opt/go-getter
curl -L https://github.com/hashicorp/go-getter/releases/download/v1.7.2/go-getter_1.7.2_linux_amd64.tar.gz \
    | tar zxf - -C /opt/go-getter

Currently, with the ZIP format archives, it is required to install additional tools and create temporary files and boilerplate code.