1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2024-12-29 01:44:39 +02:00

refactor: pipe.Skipf

This commit is contained in:
Carlos A Becker 2023-03-22 23:49:48 -03:00
parent ede2ff90e4
commit 7229a0dab0
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
3 changed files with 8 additions and 2 deletions

View File

@ -145,7 +145,7 @@ func getPassword(ctx *context.Context, upload *config.Upload, kind string) strin
} }
func misconfigured(kind string, upload *config.Upload, reason string) error { func misconfigured(kind string, upload *config.Upload, reason string) error {
return pipe.Skip(fmt.Sprintf("%s section '%s' is not configured properly (%s)", kind, upload.Name, reason)) return pipe.Skipf("%s section '%s' is not configured properly (%s)", kind, upload.Name, reason)
} }
// ResponseChecker is a function capable of validating an http server response. // ResponseChecker is a function capable of validating an http server response.

View File

@ -3,6 +3,7 @@ package pipe
import ( import (
"errors" "errors"
"fmt"
"strings" "strings"
) )
@ -45,6 +46,11 @@ func Skip(reason string) ErrSkip {
return ErrSkip{reason: reason} return ErrSkip{reason: reason}
} }
// Skipf skips this pipe with the given reason.
func Skipf(format string, a ...any) ErrSkip {
return Skip(fmt.Sprintf(format, a...))
}
// SkipMemento remembers previous skip errors so you can return them all at once later. // SkipMemento remembers previous skip errors so you can return them all at once later.
type SkipMemento struct { type SkipMemento struct {
skips []string skips []string

View File

@ -148,7 +148,7 @@ func makeUniversalBinary(ctx *context.Context, opts *build.Options, unibin confi
binaries := ctx.Artifacts.Filter(filterFor(unibin)).List() binaries := ctx.Artifacts.Filter(filterFor(unibin)).List()
if len(binaries) == 0 { if len(binaries) == 0 {
return pipe.Skip(fmt.Sprintf("no darwin binaries found with id %q", unibin.ID)) return pipe.Skipf("no darwin binaries found with id %q", unibin.ID)
} }
log.WithField("id", unibin.ID). log.WithField("id", unibin.ID).