refactor: add more go linters (#970)

This commit is contained in:
Oleg Lobanov
2020-06-01 01:12:36 +02:00
committed by GitHub
parent 54d92a2708
commit 700f32718e
56 changed files with 436 additions and 221 deletions

View File

@@ -33,7 +33,9 @@ func (s *Storage) GetByHash(hash string) (*Link, error) {
}
if link.Expire != 0 && link.Expire <= time.Now().Unix() {
s.Delete(link.Hash)
if err := s.Delete(link.Hash); err != nil {
return nil, err
}
return nil, errors.ErrNotExist
}
@@ -55,7 +57,9 @@ func (s *Storage) Gets(path string, id uint) ([]*Link, error) {
for i, link := range links {
if link.Expire != 0 && link.Expire <= time.Now().Unix() {
s.Delete(link.Hash)
if err := s.Delete(link.Hash); err != nil {
return nil, err
}
links = append(links[:i], links[i+1:]...)
}
}