lint: improve error handling

This commit is contained in:
Will Norris 2022-01-22 10:29:37 -08:00
parent ef8aec77a9
commit a81add5d96
6 changed files with 9 additions and 5 deletions

View file

@ -9,6 +9,7 @@ import (
"bytes"
"crypto/md5"
"encoding/hex"
"errors"
"io"
"io/ioutil"
"log"
@ -36,7 +37,8 @@ func (c *cache) Get(key string) ([]byte, bool) {
resp, err := c.GetObject(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok && aerr.Code() != "NoSuchKey" {
var aerr awserr.Error
if errors.As(err, &aerr) && aerr.Code() != "NoSuchKey" {
log.Printf("error fetching from s3: %v", aerr)
}
return nil, false