github.phpd.cn/goreleaser/goreleaser@v0.92.0/internal/pipe/git/errors.go (about)

     1  package git
     2  
     3  import (
     4  	"errors"
     5  	"fmt"
     6  )
     7  
     8  // ErrInvalidVersionFormat is return when the version isnt in a valid format
     9  type ErrInvalidVersionFormat struct {
    10  	version string
    11  }
    12  
    13  func (e ErrInvalidVersionFormat) Error() string {
    14  	return fmt.Sprintf("%v is not in a valid version format", e.version)
    15  }
    16  
    17  // ErrDirty happens when the repo has uncommitted/unstashed changes
    18  type ErrDirty struct {
    19  	status string
    20  }
    21  
    22  func (e ErrDirty) Error() string {
    23  	return fmt.Sprintf("git is currently in a dirty state:\n%v", e.status)
    24  }
    25  
    26  // ErrWrongRef happens when the HEAD reference is different from the tag being built
    27  type ErrWrongRef struct {
    28  	commit, tag string
    29  }
    30  
    31  func (e ErrWrongRef) Error() string {
    32  	return fmt.Sprintf("git tag %v was not made against commit %v", e.tag, e.commit)
    33  }
    34  
    35  // ErrNoTag happens if the underlying git repository doesn't contain any tags
    36  // but no snapshot-release was requested.
    37  var ErrNoTag = errors.New("git doesn't contain any tags. Either add a tag or use --snapshot")
    38  
    39  // ErrNotRepository happens if you try to run goreleaser against a folder
    40  // which is not a git repository.
    41  var ErrNotRepository = errors.New("current folder is not a git repository")
    42  
    43  // ErrNoGit happens when git is not present in PATH.
    44  var ErrNoGit = errors.New("git not present in PATH")