1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-11-06 09:09:29 +02:00

feat: back-reference build artifacts from archive artifact (#908)

This commit is contained in:
Carlos Alexandro Becker
2019-01-01 14:40:17 -02:00
committed by GitHub
parent e1eeba292f
commit 850205abf1
10 changed files with 71 additions and 35 deletions

View File

@@ -64,13 +64,13 @@ func New(ctx *context.Context) *Template {
// WithArtifact populates fields from the artifact and replacements
func (t *Template) WithArtifact(a artifact.Artifact, replacements map[string]string) *Template {
var bin = a.Extra[binary]
if bin == "" {
bin = t.fields[projectName].(string)
if bin == nil {
bin = t.fields[projectName]
}
t.fields[os] = replace(replacements, a.Goos)
t.fields[arch] = replace(replacements, a.Goarch)
t.fields[arm] = replace(replacements, a.Goarm)
t.fields[binary] = bin
t.fields[binary] = bin.(string)
t.fields[artifactName] = a.Name
return t
}

View File

@@ -44,7 +44,7 @@ func TestWithArtifact(t *testing.T) {
Goarch: "amd64",
Goos: "linux",
Goarm: "6",
Extra: map[string]string{
Extra: map[string]interface{}{
"Binary": "binary",
},
},