clean code, add golangci config, preallocate some slices and avoid copying body before parsing json (#9)
This commit is contained in:
parent
0a146c515c
commit
c7a2612056
12 changed files with 49 additions and 45 deletions
|
@ -103,12 +103,12 @@ func StoreMedias(
|
|||
msgs []gotgbot.Message,
|
||||
medias []*models.DownloadedMedia,
|
||||
) error {
|
||||
var storedMedias []*models.Media
|
||||
|
||||
if len(medias) == 0 {
|
||||
return errors.New("no media to store")
|
||||
}
|
||||
|
||||
storedMedias := make([]*models.Media, 0, len(medias))
|
||||
|
||||
for idx, msg := range msgs {
|
||||
fileID := GetMessageFileID(&msg)
|
||||
if len(fileID) == 0 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue