mirror of
https://github.com/golang/go
synced 2024-11-07 12:36:27 -07:00
cmd/go/internal/modfetch: use errors.ErrUnsupported
CL 473935 added errors.ErrUnsupported, let's use it. Updates #41198 Change-Id: If6534d19cb31ca979ff00d529bd6bdfc964a616d Reviewed-on: https://go-review.googlesource.com/c/go/+/476135 Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Bryan Mills <bcmills@google.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com>
This commit is contained in:
parent
08c3299829
commit
ebf8e26d03
@ -201,19 +201,6 @@ func (noCommitsError) Is(err error) bool {
|
|||||||
return err == fs.ErrNotExist
|
return err == fs.ErrNotExist
|
||||||
}
|
}
|
||||||
|
|
||||||
// ErrUnsupported indicates that a requested operation cannot be performed,
|
|
||||||
// because it is unsupported. This error indicates that there is no alternative
|
|
||||||
// way to perform the operation.
|
|
||||||
//
|
|
||||||
// TODO(#41198): Remove this declaration and use errors.ErrUnsupported instead.
|
|
||||||
var ErrUnsupported = unsupportedOperationError{}
|
|
||||||
|
|
||||||
type unsupportedOperationError struct{}
|
|
||||||
|
|
||||||
func (unsupportedOperationError) Error() string {
|
|
||||||
return "unsupported operation"
|
|
||||||
}
|
|
||||||
|
|
||||||
// AllHex reports whether the revision rev is entirely lower-case hexadecimal digits.
|
// AllHex reports whether the revision rev is entirely lower-case hexadecimal digits.
|
||||||
func AllHex(rev string) bool {
|
func AllHex(rev string) bool {
|
||||||
for i := 0; i < len(rev); i++ {
|
for i := 0; i < len(rev); i++ {
|
||||||
|
@ -288,7 +288,7 @@ func (r *vcsRepo) loadBranches() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *vcsRepo) CheckReuse(old *Origin, subdir string) error {
|
func (r *vcsRepo) CheckReuse(old *Origin, subdir string) error {
|
||||||
return fmt.Errorf("vcs %s: CheckReuse: %w", r.cmd.vcs, ErrUnsupported)
|
return fmt.Errorf("vcs %s: CheckReuse: %w", r.cmd.vcs, errors.ErrUnsupported)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *vcsRepo) Tags(prefix string) (*Tags, error) {
|
func (r *vcsRepo) Tags(prefix string) (*Tags, error) {
|
||||||
@ -412,7 +412,7 @@ func (r *vcsRepo) RecentTag(rev, prefix string, allowed func(string) bool) (tag
|
|||||||
}
|
}
|
||||||
defer unlock()
|
defer unlock()
|
||||||
|
|
||||||
return "", vcsErrorf("vcs %s: RecentTag: %w", r.cmd.vcs, ErrUnsupported)
|
return "", vcsErrorf("vcs %s: RecentTag: %w", r.cmd.vcs, errors.ErrUnsupported)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *vcsRepo) DescendsFrom(rev, tag string) (bool, error) {
|
func (r *vcsRepo) DescendsFrom(rev, tag string) (bool, error) {
|
||||||
@ -422,12 +422,12 @@ func (r *vcsRepo) DescendsFrom(rev, tag string) (bool, error) {
|
|||||||
}
|
}
|
||||||
defer unlock()
|
defer unlock()
|
||||||
|
|
||||||
return false, vcsErrorf("vcs %s: DescendsFrom: %w", r.cmd.vcs, ErrUnsupported)
|
return false, vcsErrorf("vcs %s: DescendsFrom: %w", r.cmd.vcs, errors.ErrUnsupported)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *vcsRepo) ReadZip(rev, subdir string, maxSize int64) (zip io.ReadCloser, err error) {
|
func (r *vcsRepo) ReadZip(rev, subdir string, maxSize int64) (zip io.ReadCloser, err error) {
|
||||||
if r.cmd.readZip == nil && r.cmd.doReadZip == nil {
|
if r.cmd.readZip == nil && r.cmd.doReadZip == nil {
|
||||||
return nil, vcsErrorf("vcs %s: ReadZip: %w", r.cmd.vcs, ErrUnsupported)
|
return nil, vcsErrorf("vcs %s: ReadZip: %w", r.cmd.vcs, errors.ErrUnsupported)
|
||||||
}
|
}
|
||||||
|
|
||||||
unlock, err := r.mu.Lock()
|
unlock, err := r.mu.Lock()
|
||||||
|
@ -608,7 +608,7 @@ func (r *codeRepo) convert(info *codehost.RevInfo, statVers string) (*RevInfo, e
|
|||||||
}
|
}
|
||||||
if pseudoBase == "" {
|
if pseudoBase == "" {
|
||||||
tag, err := r.code.RecentTag(info.Name, tagPrefix, tagAllowed)
|
tag, err := r.code.RecentTag(info.Name, tagPrefix, tagAllowed)
|
||||||
if err != nil && !errors.Is(err, codehost.ErrUnsupported) {
|
if err != nil && !errors.Is(err, errors.ErrUnsupported) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if tag != "" {
|
if tag != "" {
|
||||||
|
Loading…
Reference in New Issue
Block a user