github.com/tomsquest/goreleaser@v0.34.3-0.20171008022654-7d6ef4d338b3/pipeline/pipe.go (about)

     1  // Package pipeline provides a generic pipe interface.
     2  package pipeline
     3  
     4  import "github.com/goreleaser/goreleaser/context"
     5  
     6  // Pipe interface
     7  type Pipe interface {
     8  	// Name of the pipe
     9  	Description() string
    10  
    11  	// Run the pipe
    12  	Run(ctx *context.Context) error
    13  }
    14  
    15  // IsSkip returns true if the error is an ErrSkip
    16  func IsSkip(err error) bool {
    17  	_, ok := err.(ErrSkip)
    18  	return ok
    19  }
    20  
    21  // ErrSkip occurs when a pipe is skipped for some reason
    22  type ErrSkip struct {
    23  	reason string
    24  }
    25  
    26  // Error implements the error interface. returns the reason the pipe was skipped
    27  func (e ErrSkip) Error() string {
    28  	return e.reason
    29  }
    30  
    31  // Skip skips this pipe with the given reason
    32  func Skip(reason string) ErrSkip {
    33  	return ErrSkip{reason}
    34  }