bump golangci-lint to 2.8.0 (#5350)

This commit is contained in:
bluenviron-bot
2026-01-15 22:43:32 +01:00
committed by GitHub
parent 4529de48dd
commit 320bd3f4ae
7 changed files with 46 additions and 21 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ jobs:
- uses: golangci/golangci-lint-action@v9
with:
version: v2.6.1
version: v2.8.0
go_mod:
runs-on: ubuntu-22.04
+1 -1
View File
@@ -208,7 +208,7 @@ func TestH264RTPOversized(t *testing.T) {
}))
require.NoError(t, err)
var out []*rtp.Packet
var out []*rtp.Packet //nolint:prealloc
for _, pkt := range []*rtp.Packet{
{
+1 -1
View File
@@ -208,7 +208,7 @@ func TestH265RTPOversized(t *testing.T) {
}))
require.NoError(t, err)
var out []*rtp.Packet
var out []*rtp.Packet //nolint:prealloc
for _, pkt := range []*rtp.Packet{
{
+4 -2
View File
@@ -584,9 +584,11 @@ func (pa *path) doAPIPathsGet(req pathAPIPathsGetReq) {
return pa.stream.BytesSent()
}(),
Readers: func() []defs.APIPathSourceOrReader {
ret := []defs.APIPathSourceOrReader{}
ret := make([]defs.APIPathSourceOrReader, len(pa.readers))
i := 0
for r := range pa.readers {
ret = append(ret, r.APIReaderDescribe())
ret[i] = r.APIReaderDescribe()
i++
}
return ret
}(),
+21 -11
View File
@@ -42,22 +42,32 @@ func FormatsInfo(formats []format.Format) string {
strings.Join(FormatsToCodecs(formats), ", "))
}
// MediasToCodecs returns the name of codecs of given formats.
func MediasToCodecs(medias []*description.Media) []string {
var formats []format.Format
func gatherFormats(medias []*description.Media) []format.Format {
n := 0
for _, media := range medias {
formats = append(formats, media.Formats...)
n += len(media.Formats)
}
return FormatsToCodecs(formats)
if n == 0 {
return nil
}
formats := make([]format.Format, n)
n = 0
for _, media := range medias {
n += copy(formats[n:], media.Formats)
}
return formats
}
// MediasToCodecs returns the name of codecs of given formats.
func MediasToCodecs(medias []*description.Media) []string {
return FormatsToCodecs(gatherFormats(medias))
}
// MediasInfo returns a description of medias.
func MediasInfo(medias []*description.Media) string {
var formats []format.Format
for _, media := range medias {
formats = append(formats, media.Formats...)
}
return FormatsInfo(formats)
return FormatsInfo(gatherFormats(medias))
}
+3 -3
View File
@@ -613,11 +613,11 @@ func TestOnGet(t *testing.T) {
sampleData := make(map[int][][]byte)
for _, track := range p.Tracks {
var samples [][]byte
for _, sample := range track.Samples {
samples := make([][]byte, len(track.Samples))
for i, sample := range track.Samples {
buf, err = sample.GetPayload()
require.NoError(t, err)
samples = append(samples, buf)
samples[i] = buf
sample.GetPayload = nil
}
sampleData[track.ID] = samples
+15 -2
View File
@@ -41,11 +41,24 @@ func (r *Reader) OnData(medi *description.Media, forma format.Format, cb OnDataF
// Formats returns all formats for which the reader has registered a OnData callback.
func (r *Reader) Formats() []format.Format {
var out []format.Format
n := 0
for _, formats := range r.onDatas {
for range formats {
n++
}
}
if n == 0 {
return nil
}
out := make([]format.Format, n)
n = 0
for _, formats := range r.onDatas {
for forma := range formats {
out = append(out, forma)
out[n] = forma
n++
}
}