1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-10 03:47:03 +02:00
goreleaser/pipeline/piper.go

38 lines
762 B
Go
Raw Normal View History

2017-04-14 20:39:32 +02:00
// Package pipeline provides a generic pipe interface.
2016-12-30 13:27:35 +02:00
package pipeline
import (
"fmt"
2016-12-30 13:27:35 +02:00
"github.com/goreleaser/goreleaser/context"
)
// Piper defines a pipe, which can be part of a pipeline (a serie of pipes).
type Piper interface {
fmt.Stringer
2016-12-30 16:41:59 +02:00
// Run the pipe
2017-01-14 18:06:57 +02:00
Run(ctx *context.Context) error
2016-12-30 13:27:35 +02:00
}
2017-08-20 21:35:46 +02:00
2017-09-12 05:22:02 +02:00
// IsSkip returns true if the error is an ErrSkip
2017-09-12 04:31:00 +02:00
func IsSkip(err error) bool {
_, ok := err.(ErrSkip)
return ok
}
2017-08-20 21:35:46 +02:00
// ErrSkip occurs when a pipe is skipped for some reason
type ErrSkip struct {
reason string
}
// Error implements the error interface. returns the reason the pipe was skipped
func (e ErrSkip) Error() string {
return e.reason
}
// Skip skips this pipe with the given reason
func Skip(reason string) ErrSkip {
return ErrSkip{reason}
}