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
|
@ -36,7 +36,6 @@ func FindBestPhoto(
|
|||
func ParseVideoFormats(
|
||||
images map[string]*Media,
|
||||
) ([]*models.MediaFormat, error) {
|
||||
var formats []*models.MediaFormat
|
||||
var video *Media
|
||||
var thumbnailURL string
|
||||
|
||||
|
@ -63,6 +62,8 @@ func ParseVideoFormats(
|
|||
"av1Url": {"Av1URL", enums.MediaCodecAV1},
|
||||
}
|
||||
|
||||
formats := make([]*models.MediaFormat, 0, len(codecMapping))
|
||||
|
||||
for _, mapping := range codecMapping {
|
||||
url := getField(video, mapping.Field)
|
||||
if url == "" {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue