1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-03-17 20:47:50 +02:00

Merge pull request #312 from goreleaser/git

moved errors to another file
This commit is contained in:
Carlos Alexandro Becker 2017-07-18 01:49:51 -03:00 committed by GitHub
commit 0e6b6451b5
2 changed files with 34 additions and 31 deletions

34
pipeline/git/errors.go Normal file
View File

@ -0,0 +1,34 @@
package git
import "fmt"
// ErrInvalidVersionFormat is return when the version isnt in a valid format
type ErrInvalidVersionFormat struct {
version string
}
func (e ErrInvalidVersionFormat) Error() string {
return fmt.Sprintf("%v is not in a valid version format", e.version)
}
// ErrDirty happens when the repo has uncommitted/unstashed changes
type ErrDirty struct {
status string
}
func (e ErrDirty) Error() string {
return fmt.Sprintf("git is currently in a dirty state:\n%v", e.status)
}
// ErrWrongRef happens when the HEAD reference is different from the tag being built
type ErrWrongRef struct {
commit, tag string
}
func (e ErrWrongRef) Error() string {
return fmt.Sprintf("git tag %v was not made against commit %v", e.tag, e.commit)
}
// ErrNoTag happens if the underlying git repository doesn't contain any tags
// but no snapshot-release was requested.
var ErrNoTag = fmt.Errorf("git doesn't contain any tags. Either add a tag or use --snapshot")

View File

@ -14,37 +14,6 @@ import (
"github.com/goreleaser/goreleaser/context"
)
// ErrInvalidVersionFormat is return when the version isnt in a valid format
type ErrInvalidVersionFormat struct {
version string
}
func (e ErrInvalidVersionFormat) Error() string {
return fmt.Sprintf("%v is not in a valid version format", e.version)
}
// ErrDirty happens when the repo has uncommitted/unstashed changes
type ErrDirty struct {
status string
}
func (e ErrDirty) Error() string {
return fmt.Sprintf("git is currently in a dirty state:\n%v", e.status)
}
// ErrWrongRef happens when the HEAD reference is different from the tag being built
type ErrWrongRef struct {
commit, tag string
}
func (e ErrWrongRef) Error() string {
return fmt.Sprintf("git tag %v was not made against commit %v", e.tag, e.commit)
}
// ErrNoTag happens if the underlying git repository doesn't contain any tags
// but no snapshot-release was requested.
var ErrNoTag = fmt.Errorf("git doesn't contain any tags. Either add a tag or use --snapshot")
// Pipe for brew deployment
type Pipe struct{}