misc: use `Err` prefix for errors

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
This commit is contained in:
Hidde Beydals 2023-10-09 12:08:02 +02:00
parent 3cf4fdfaa8
commit 354a8e8dbf
No known key found for this signature in database
GPG Key ID: 979F380FC2341744
2 changed files with 5 additions and 5 deletions

View File

@ -41,7 +41,7 @@ type mockBucketClient struct {
objects map[string]mockBucketObject
}
var mockNotFound = fmt.Errorf("not found")
var errMockNotFound = fmt.Errorf("not found")
func (m mockBucketClient) BucketExists(_ context.Context, name string) (bool, error) {
return name == m.bucketName, nil
@ -57,7 +57,7 @@ func (m mockBucketClient) FGetObject(_ context.Context, bucket, obj, path string
}
object, ok := m.objects[obj]
if !ok {
return "", mockNotFound
return "", errMockNotFound
}
if err := os.WriteFile(path, []byte(object.data), os.FileMode(0660)); err != nil {
return "", err
@ -66,7 +66,7 @@ func (m mockBucketClient) FGetObject(_ context.Context, bucket, obj, path string
}
func (m mockBucketClient) ObjectIsNotFound(e error) bool {
return e == mockNotFound
return e == errMockNotFound
}
func (m mockBucketClient) VisitObjects(_ context.Context, _ string, f func(key, etag string) error) error {

View File

@ -32,7 +32,7 @@ import (
)
var (
ObjectNotFound = errors.New("object not found")
ErrObjectNotFound = errors.New("object not found")
)
// Object is a mock Server object.
@ -101,7 +101,7 @@ func (s *Server) getObjectFile(key string, generation int64) ([]byte, error) {
}
}
}
return nil, ObjectNotFound
return nil, ErrObjectNotFound
}
func (s *Server) handler(w http.ResponseWriter, r *http.Request) {