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

fix(archive): warn only for non-default globs with no matches (#4013)

Adjust the logging of warnings for unmatched globs to only show when the
glob is not a default. No warning will be output for the default globs
when there are no matching files.

These are defaults, by design, very generic.
We should not warn the user about them not finding anything, as that is
their expected behavior most of the time.
This commit is contained in:
Carlos Alexandro Becker 2023-05-16 09:22:22 -03:00 committed by GitHub
parent 234e1d8ce5
commit b5e8d6db06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 7 deletions

View File

@ -31,7 +31,11 @@ func Eval(template *tmpl.Template, rlcp bool, files []config.File) ([]config.Fil
}
if len(files) == 0 {
log.WithField("glob", f.Source).Warn("no files matched")
if !f.Default {
// only log if its not a default glob, as those are usually
// very generic and are not really warnings for the user.
log.WithField("glob", f.Source).Warn("no files matched")
}
continue
}

View File

@ -64,12 +64,12 @@ func (Pipe) Default(ctx *context.Context) error {
}
if len(archive.Files) == 0 {
archive.Files = []config.File{
{Source: "license*"},
{Source: "LICENSE*"},
{Source: "readme*"},
{Source: "README*"},
{Source: "changelog*"},
{Source: "CHANGELOG*"},
{Source: "license*", Default: true},
{Source: "LICENSE*", Default: true},
{Source: "readme*", Default: true},
{Source: "README*", Default: true},
{Source: "changelog*", Default: true},
{Source: "CHANGELOG*", Default: true},
}
}
if archive.NameTemplate == "" {

View File

@ -464,6 +464,7 @@ type File struct {
Destination string `yaml:"dst,omitempty" json:"dst,omitempty"`
StripParent bool `yaml:"strip_parent,omitempty" json:"strip_parent,omitempty"`
Info FileInfo `yaml:"info,omitempty" json:"info,omitempty"`
Default bool `yaml:"-" json:"-"`
}
// FileInfo is the file info of a file.