1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-18 03:56:52 +02:00

fix: nfpm default build ids to empty

This commit is contained in:
Carlos A Becker 2022-04-11 23:59:52 -03:00
parent cd7edb7a2e
commit 9dfade2558
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
3 changed files with 2 additions and 15 deletions

View File

@ -54,11 +54,6 @@ func (Pipe) Default(ctx *context.Context) error {
if fpm.FileNameTemplate == "" {
fpm.FileNameTemplate = defaultNameTemplate
}
if len(fpm.Builds) == 0 { // TODO: change this to empty by default and deal with it in the filtering code
for _, b := range ctx.Config.Builds {
fpm.Builds = append(fpm.Builds, b.ID)
}
}
ids.Inc(fpm.ID)
}

View File

@ -565,15 +565,11 @@ func TestDefault(t *testing.T) {
NFPMs: []config.NFPM{
{},
},
Builds: []config.Build{
{ID: "foo"},
{ID: "bar"},
},
},
}
require.NoError(t, Pipe{}.Default(ctx))
require.Equal(t, "/usr/bin", ctx.Config.NFPMs[0].Bindir)
require.Equal(t, []string{"foo", "bar"}, ctx.Config.NFPMs[0].Builds)
require.Empty(t, ctx.Config.NFPMs[0].Builds)
require.Equal(t, defaultNameTemplate, ctx.Config.NFPMs[0].FileNameTemplate)
require.Equal(t, ctx.Config.ProjectName, ctx.Config.NFPMs[0].PackageName)
}
@ -581,10 +577,6 @@ func TestDefault(t *testing.T) {
func TestDefaultSet(t *testing.T) {
ctx := &context.Context{
Config: config.Project{
Builds: []config.Build{
{ID: "foo"},
{ID: "bar"},
},
NFPMs: []config.NFPM{
{
Builds: []string{"foo"},

View File

@ -24,7 +24,7 @@ nfpms:
file_name_template: "{{ .ConventionalFileName }}"
# Build IDs for the builds you want to create NFPM packages for.
# Defaults to all builds.
# Defaults empty, which means no filtering.
builds:
- foo
- bar