github.1git.de/goreleaser/goreleaser@v0.92.0/internal/pipe/pipe.go (about)

     1  // Package pipe provides generic erros for pipes to use.
     2  package pipe
     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  // ErrSkipSignEnabled happens if --skip-sign is set.
    13  // It means that the part of a Piper that signs some things was not run.
    14  var ErrSkipSignEnabled = Skip("artifact signing is disabled")
    15  
    16  // ErrSkipValidateEnabled happens if --skip-validate is set.
    17  // It means that the part of a Piper that validates some things was not run.
    18  var ErrSkipValidateEnabled = Skip("validation is disabled")
    19  
    20  // IsSkip returns true if the error is an ErrSkip
    21  func IsSkip(err error) bool {
    22  	_, ok := err.(ErrSkip)
    23  	return ok
    24  }
    25  
    26  // ErrSkip occurs when a pipe is skipped for some reason
    27  type ErrSkip struct {
    28  	reason string
    29  }
    30  
    31  // Error implements the error interface. returns the reason the pipe was skipped
    32  func (e ErrSkip) Error() string {
    33  	return e.reason
    34  }
    35  
    36  // Skip skips this pipe with the given reason
    37  func Skip(reason string) ErrSkip {
    38  	return ErrSkip{reason: reason}
    39  }