github.com/szyn/goreleaser@v0.76.1-0.20180517112710-333da09a1297/pipeline/pipeline.go (about)

     1  // Package pipeline provides generic erros for pipes to use.
     2  package pipeline
     3  
     4  // ErrSnapshotEnabled happens when goreleaser is running in snapshot mode.
     5  // It usually means that publishing and maybe some validations were skipped.
     6  var ErrSnapshotEnabled = Skip("disabled during snapshot mode")
     7  
     8  // ErrSkipPublishEnabled happens if --skip-publish is set.
     9  // It means that the part of a Piper that publishes its artifacts was not run.
    10  var ErrSkipPublishEnabled = Skip("publishing is disabled")
    11  
    12  // ErrSkipValidateEnabled happens if --skip-validate is set.
    13  // It means that the part of a Piper that validates some things was not run.
    14  var ErrSkipValidateEnabled = Skip("validation is disabled")
    15  
    16  // IsSkip returns true if the error is an ErrSkip
    17  func IsSkip(err error) bool {
    18  	_, ok := err.(ErrSkip)
    19  	return ok
    20  }
    21  
    22  // ErrSkip occurs when a pipe is skipped for some reason
    23  type ErrSkip struct {
    24  	reason string
    25  }
    26  
    27  // Error implements the error interface. returns the reason the pipe was skipped
    28  func (e ErrSkip) Error() string {
    29  	return e.reason
    30  }
    31  
    32  // Skip skips this pipe with the given reason
    33  func Skip(reason string) ErrSkip {
    34  	return ErrSkip{reason}
    35  }