fix(lint): remove naked returns

This commit is contained in:
Gabe Kangas 2023-06-02 12:22:00 -07:00
parent 35bdb5bca2
commit 2ed253d9f2
No known key found for this signature in database
GPG key ID: 4345B2060657F330

View file

@ -376,18 +376,18 @@ func DecodeBase64Image(url string) (bytes []byte, extension string, err error) {
s := strings.SplitN(url, ",", 2) s := strings.SplitN(url, ",", 2)
if len(s) < 2 { if len(s) < 2 {
err = errors.New("error splitting base64 image data") err = errors.New("error splitting base64 image data")
return return nil, "", err
} }
bytes, err = base64.StdEncoding.DecodeString(s[1]) bytes, err = base64.StdEncoding.DecodeString(s[1])
if err != nil { if err != nil {
return return nil, "", err
} }
splitHeader := strings.Split(s[0], ":") splitHeader := strings.Split(s[0], ":")
if len(splitHeader) < 2 { if len(splitHeader) < 2 {
err = errors.New("error splitting base64 image header") err = errors.New("error splitting base64 image header")
return return nil, "", err
} }
contentType := strings.Split(splitHeader[1], ";")[0] contentType := strings.Split(splitHeader[1], ";")[0]
@ -404,7 +404,7 @@ func DecodeBase64Image(url string) (bytes []byte, extension string, err error) {
if extension == "" { if extension == "" {
err = errors.New("missing or invalid contentType in base64 image") err = errors.New("missing or invalid contentType in base64 image")
return return nil, "", err
} }
return bytes, extension, nil return bytes, extension, nil