Goreleaser: Templating in binary field of build

Created on 25 Jun 2019  路  5Comments  路  Source: goreleaser/goreleaser

Describe the bug

Not sure if this is really a bug or simply a change in behavior between versions. However, in version 0.85.1 you were able to use templating for binary names.

Given the following yaml:

builds:
- binary: "{{ .ProjectName }}_{{ .Tag }}"

In version 0.85.1, the binary ended up in the following path:

dist/darwin_386/terraform-provider-healthchecksio_v1.3.0

In version 0.110.0, the binary ends up in a path suggesting templating is no longer supported or broken:

dist/{{ .ProjectName }}_{{ .Tag }}_darwin_386/terraform-provider-healthchecksio_v1.3.0

I would prefer to keep the old style. Is there a way to configure the final dist path (including the directory name and binary name) in v 0.110.0 and above?

To Reproduce

Steps to reproduce the behavior:

# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
before:
  hooks:
    - go mod download
builds:
- binary: "{{ .ProjectName }}_{{ .Tag }}"
  env:
  - CGO_ENABLED=0
  - GO111MODULE=on
archives:
- replacements:
    darwin: Darwin
    linux: Linux
    windows: Windows
    386: i386
    amd64: x86_64
checksum:
  name_template: 'checksums.txt'
snapshot:
  name_template: "{{ .Tag }}-next"
changelog:
  sort: asc
  filters:
    exclude:
    - '^examples:'
    - '^docs:'
    - '^test:'

Expected behavior

I expect the binary field to support templating as it did in version 0.85.1 or other option to replicate the old behavior.

Environment (please complete the following information):

  • OS: mac
  • OS version: darwin
  • GoReleaser Version: 0.110.0
bug

All 5 comments

OK, workaround:

builds:
- id: my-build-id 
  binary: "{{ .ProjectName }}_{{ .Tag }}"
  env:
  - CGO_ENABLED=0
  - GO111MODULE=on

thanks for reporting!

Thanks, the workaround partially works. Only issue now is I get the build id as a prefix for the dist directory names (ie. dist/my-build-id_darwin_386/terraform-provider-healthchecksio_v1.3.0). But the binary name is now correct.

Thanks for a great project BTW!

the prefix on the dist is as expected, see https://github.com/goreleaser/goreleaser/pull/1041

its because now you can have multiple builds and multiple archives and etc..

Thanks for a great project BTW!

thanks :D

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

avenda picture avenda  路  3Comments

fheidenreich picture fheidenreich  路  4Comments

michelvocks picture michelvocks  路  3Comments

caarlos0 picture caarlos0  路  3Comments

tisba picture tisba  路  4Comments