1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-03-17 20:47:50 +02:00

accept both BinaryName and Binary on name_template

This commit is contained in:
Carlos Alexandro Becker 2017-03-22 21:11:53 -03:00
parent f4024df0e6
commit 0031425871
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940

View File

@ -2,6 +2,8 @@ package build
import (
"bytes"
"log"
"strings"
"text/template"
"github.com/goreleaser/goreleaser/context"
@ -21,6 +23,18 @@ func nameFor(ctx *context.Context, goos, goarch string) (string, error) {
Version: ctx.Git.CurrentTag,
Binary: ctx.Config.Build.Binary,
}
// TODO: remove this block in next release cycle
if strings.Contains(ctx.Config.Archive.NameTemplate, ".BinaryName") {
log.Println("The `.BinaryName` in `archive.name_template` is deprecated and will soon be removed. Please check the README for more info.")
ctx.Config.Archive.NameTemplate = strings.Replace(
ctx.Config.Archive.NameTemplate,
".BinaryName",
".Binary",
-1,
)
}
var out bytes.Buffer
t, err := template.New(data.Binary).Parse(ctx.Config.Archive.NameTemplate)
if err != nil {