upload/azure: remove an unneeded custom error type

The errorString was not exported and used anywhere else, this commit replaces
it with a standard method of creating simple errors.
This commit is contained in:
Ondřej Budai 2020-04-28 13:20:54 +02:00
parent e52a35d84e
commit 5415be465f

View file

@ -5,6 +5,7 @@ import (
"bytes"
"context"
"crypto/md5"
"errors"
"fmt"
"io"
"net/url"
@ -14,14 +15,6 @@ import (
"github.com/Azure/azure-storage-blob-go/azblob"
)
type errorString struct {
s string
}
func (e *errorString) Error() string {
return e.s
}
// Credentials contains credentials to connect to your account
// It uses so called "Client credentials", see the official documentation for more information:
// https://docs.microsoft.com/en-us/azure/go/azure-sdk-go-authorization#available-authentication-types-and-methods
@ -153,7 +146,7 @@ func UploadImage(credentials Credentials, metadata ImageMetadata, fileName strin
var fileChecksum []byte = imageFileHash.Sum(nil)
if !bytes.Equal(blobChecksum, fileChecksum) {
return &errorString{"error during image upload. the image seems to be corrupted"}
return errors.New("error during image upload. the image seems to be corrupted")
}
return nil