bump golangci-lint to 2.13.1 (#6129)

* bump golangci-lint to 2.13.1

* additional changes

---------

Co-authored-by: aler9 <46489434+aler9@users.noreply.github.com>
This commit is contained in:
bluenviron-bot
2026-08-22 16:57:28 +00:00
committed by GitHub
co-authored by aler9
parent f6625b9e5f
commit 3e09466c18
20 changed files with 76 additions and 61 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ jobs:
- uses: golangci/golangci-lint-action@v9
with:
version: v2.12.2
version: v2.13.1
go_mod:
runs-on: ubuntu-24.04
+1 -1
View File
@@ -295,7 +295,7 @@ func (m *Manager) pullJWTJWKS() (jwt.Keyfunc, error) {
defer tr.CloseIdleConnections()
httpClient := &http.Client{
Timeout: (m.ReadTimeout),
Timeout: m.ReadTimeout,
Transport: tr,
}
+3 -3
View File
@@ -30,7 +30,7 @@ func loadEnvInternal(env map[string]string, prefix string, prv reflect.Value) er
rt := prv.Type().Elem()
if i, ok := prv.Interface().(Unmarshaler); ok {
if i, ok := reflect.TypeAssert[Unmarshaler](prv); ok {
if ev, ok2 := env[prefix]; ok2 {
if prv.IsNil() {
prv.Set(reflect.New(rt))
@@ -124,8 +124,8 @@ func loadEnvInternal(env map[string]string, prefix string, prv reflect.Value) er
continue
}
mapKey := strings.Split(k[len(prefix+"_"):], "_")[0]
if len(mapKey) == 0 {
mapKey, _, _ := strings.Cut(k[len(prefix+"_"):], "_")
if mapKey == "" {
continue
}
+1 -1
View File
@@ -60,7 +60,7 @@ func decode(v reflect.Value, raw json.RawMessage, path string) error {
v = v.Elem()
}
if unm, ok := v.Addr().Interface().(json.Unmarshaler); ok {
if unm, ok := reflect.TypeAssert[json.Unmarshaler](v.Addr()); ok {
return unm.UnmarshalJSON(raw)
}
+1 -1
View File
@@ -41,7 +41,7 @@ func (e *Estimator) Estimate(pts int64) time.Time {
return now
}
computed := e.refNTP.Add((multiplyAndDivide(time.Duration(pts-e.refPTS), time.Second, time.Duration(e.ClockRate))))
computed := e.refNTP.Add(multiplyAndDivide(time.Duration(pts-e.refPTS), time.Second, time.Duration(e.ClockRate)))
if computed.After(now) || computed.Before(now.Add(-maxTimeDifference)) {
e.refNTP = now
+7 -4
View File
@@ -42,7 +42,8 @@ func writeSegment1(t *testing.T, fpath string) {
Config: mpeg4audio.AudioSpecificConfig{
Type: mpeg4audio.ObjectTypeAACLC,
SampleRate: 48000,
ChannelCount: 2,
ChannelCount: 2, //nolint:staticcheck
ChannelConfig: 2,
},
},
},
@@ -120,7 +121,8 @@ func writeSegment2(t *testing.T, fpath string) {
Config: mpeg4audio.AudioSpecificConfig{
Type: mpeg4audio.ObjectTypeAACLC,
SampleRate: 48000,
ChannelCount: 2,
ChannelConfig: 2,
ChannelCount: 2, //nolint:staticcheck
},
},
},
@@ -262,7 +264,8 @@ func TestOnGet(t *testing.T) {
Config: mpeg4audio.AudioSpecificConfig{
Type: mpeg4audio.ObjectTypeAACLC,
SampleRate: 48000,
ChannelCount: 2,
ChannelCount: 2, //nolint:staticcheck
ChannelConfig: 2,
},
},
},
@@ -662,7 +665,7 @@ func TestOnGet(t *testing.T) {
Config: mpeg4audio.AudioSpecificConfig{
Type: mpeg4audio.ObjectTypeAACLC,
SampleRate: 48000,
ChannelCount: 2,
ChannelCount: 2, //nolint:staticcheck
ChannelConfig: 2,
},
},
+6 -3
View File
@@ -34,7 +34,8 @@ func writeBenchInit(f io.WriteSeeker) {
Config: mpeg4audio.AudioSpecificConfig{
Type: mpeg4audio.ObjectTypeAACLC,
SampleRate: 48000,
ChannelCount: 2,
ChannelCount: 2, //nolint:staticcheck
ChannelConfig: 2,
},
},
},
@@ -100,7 +101,8 @@ func TestSegmentFMP4CanBeConcatenated(t *testing.T) {
Config: mpeg4audio.AudioSpecificConfig{
Type: mpeg4audio.ObjectTypeAACLC,
SampleRate: 48000,
ChannelCount: 2,
ChannelConfig: 2,
ChannelCount: 2, //nolint:staticcheck
},
},
},
@@ -408,7 +410,8 @@ func TestSegmentFMP4CanBeConcatenated(t *testing.T) {
Config: mpeg4audio.AudioSpecificConfig{
Type: mpeg4audio.ObjectTypeAACLC,
SampleRate: 48000,
ChannelCount: 2,
ChannelConfig: 2,
ChannelCount: 2, //nolint:staticcheck
},
},
},
+3 -2
View File
@@ -68,7 +68,8 @@ func TestToStream(t *testing.T) {
AudioSpecificConfig: &mpeg4audio.AudioSpecificConfig{
Type: 2,
SampleRate: 48000,
ChannelCount: 2,
ChannelConfig: 2,
ChannelCount: 2, //nolint:staticcheck
},
LatmBufferFullness: 255,
}},
@@ -137,7 +138,7 @@ func TestToStream(t *testing.T) {
AudioSpecificConfig: &mpeg4audio.AudioSpecificConfig{
Type: 2,
SampleRate: 48000,
ChannelCount: 2,
ChannelCount: 2, //nolint:staticcheck
ChannelConfig: 2,
},
LatmBufferFullness: 255,
+2 -2
View File
@@ -23,8 +23,8 @@ type Listener struct {
func (l *Listener) Initialize() {
l.inner = &proxyproto.Listener{
Listener: l.Wrapped,
Policy: func(upstream net.Addr) (proxyproto.Policy, error) {
tcpAddr, ok := upstream.(*net.TCPAddr)
ConnPolicy: func(connPolicyOptions proxyproto.ConnPolicyOptions) (proxyproto.Policy, error) {
tcpAddr, ok := connPolicyOptions.Upstream.(*net.TCPAddr)
if ok && l.TrustedProxies.Contains(tcpAddr.IP) {
return proxyproto.USE, nil
}
+5 -4
View File
@@ -1,4 +1,4 @@
package proxy
package proxy_test
import (
"fmt"
@@ -9,6 +9,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/bluenviron/mediamtx/internal/conf"
"github.com/bluenviron/mediamtx/internal/protocols/proxy"
)
func trustedProxies(cidrs ...string) conf.IPNetworks {
@@ -30,7 +31,7 @@ func TestListenerTrustedWithHeader(t *testing.T) {
require.NoError(t, err)
defer ln.Close()
wrapped := &Listener{Wrapped: ln, TrustedProxies: trustedProxies("127.0.0.1/32")}
wrapped := &proxy.Listener{Wrapped: ln, TrustedProxies: trustedProxies("127.0.0.1/32")}
wrapped.Initialize()
done := make(chan struct{})
@@ -69,7 +70,7 @@ func TestListenerTrustedWithoutHeader(t *testing.T) {
require.NoError(t, err)
defer ln.Close()
wrapped := &Listener{Wrapped: ln, TrustedProxies: trustedProxies("127.0.0.1/32")}
wrapped := &proxy.Listener{Wrapped: ln, TrustedProxies: trustedProxies("127.0.0.1/32")}
wrapped.Initialize()
done := make(chan struct{})
@@ -102,7 +103,7 @@ func TestListenerUntrustedIgnoresHeader(t *testing.T) {
require.NoError(t, err)
defer ln.Close()
wrapped := &Listener{Wrapped: ln, TrustedProxies: trustedProxies("10.0.0.0/8")}
wrapped := &proxy.Listener{Wrapped: ln, TrustedProxies: trustedProxies("10.0.0.0/8")}
wrapped.Initialize()
done := make(chan struct{})
+1 -1
View File
@@ -710,7 +710,7 @@ func TestFromStreamLegacyClientMultipleTracks(t *testing.T) {
aacConfig2 := &mpeg4audio.AudioSpecificConfig{
Type: 2, // MPEG4-AAC LC
SampleRate: 48000,
ChannelCount: 2,
ChannelCount: 2, //nolint:staticcheck
ChannelConfig: 2,
}
-1
View File
@@ -772,7 +772,6 @@ func (f *formatFMP4) initialize() bool {
codec := &mcodecs.AC3{
SampleRate: origFormat.SampleRate,
ChannelCount: origFormat.ChannelCount,
Fscod: 0,
Bsid: 8,
Bsmod: 0,
Acmod: 7,
+4 -1
View File
@@ -16,6 +16,7 @@ import (
"github.com/bluenviron/mediacommon/v2/pkg/codecs/mpeg4video"
"github.com/bluenviron/mediacommon/v2/pkg/formats/mpegts"
tscodecs "github.com/bluenviron/mediacommon/v2/pkg/formats/mpegts/codecs"
"github.com/bluenviron/mediacommon/v2/pkg/formats/mpegts/substructs"
"github.com/bluenviron/mediamtx/internal/defs"
"github.com/bluenviron/mediamtx/internal/formatlabel"
@@ -243,7 +244,9 @@ func (f *formatMPEGTS) initialize() bool {
case *rtspformat.Opus:
track := addTrack(&tscodecs.Opus{
ChannelCount: forma.ChannelCount,
Desc: &substructs.OpusAudioDescriptor{
ChannelConfigCode: 2,
},
})
f.ri.reader.OnData(
+9 -5
View File
@@ -45,7 +45,8 @@ func TestRecorder(t *testing.T) {
Config: &mpeg4audio.AudioSpecificConfig{
Type: 2,
SampleRate: 44100,
ChannelCount: 2,
ChannelConfig: 2,
ChannelCount: 2, //nolint:staticcheck
},
SizeLength: 13,
IndexLength: 3,
@@ -280,7 +281,7 @@ func TestRecorder(t *testing.T) {
Config: mpeg4audio.AudioSpecificConfig{
Type: 2,
SampleRate: 44100,
ChannelCount: 2,
ChannelCount: 2, //nolint:staticcheck
ChannelConfig: 2,
},
},
@@ -413,7 +414,8 @@ func TestRecorderFMP4NegativeInitialDTS(t *testing.T) {
Config: &mpeg4audio.AudioSpecificConfig{
Type: 2,
SampleRate: 44100,
ChannelCount: 2,
ChannelConfig: 2,
ChannelCount: 2, //nolint:staticcheck
},
SizeLength: 13,
IndexLength: 3,
@@ -506,7 +508,8 @@ func TestRecorderFMP4NegativeDTSDiff(t *testing.T) {
Config: &mpeg4audio.AudioSpecificConfig{
Type: 2,
SampleRate: 44100,
ChannelCount: 2,
ChannelConfig: 2,
ChannelCount: 2, //nolint:staticcheck
},
SizeLength: 13,
IndexLength: 3,
@@ -865,7 +868,8 @@ func TestRecorderTimeDriftDetector(t *testing.T) {
Config: &mpeg4audio.AudioSpecificConfig{
Type: 2,
SampleRate: 44100,
ChannelCount: 2,
ChannelConfig: 2,
ChannelCount: 2, //nolint:staticcheck
},
SizeLength: 13,
IndexLength: 3,
+1 -1
View File
@@ -397,7 +397,7 @@ func TestServerRead(t *testing.T) {
Codec: &codecs.MPEG4Audio{
Config: mpeg4audio.AudioSpecificConfig{
Type: 2,
ChannelCount: 2,
ChannelCount: 2, //nolint:staticcheck
ChannelConfig: 2,
SampleRate: 44100,
},
+1 -1
View File
@@ -238,7 +238,7 @@ func (s *Server) Log(level logger.Level, format string, args ...any) {
func (s *Server) Close() {
s.Log(logger.Info, "closing")
if !interfaceIsEmpty((s.Metrics)) {
if !interfaceIsEmpty(s.Metrics) {
if s.Encryption {
s.Metrics.SetRTMPSServer(nil)
} else {
+2 -1
View File
@@ -27,7 +27,8 @@ func TestSource(t *testing.T) {
Config: mpeg4audio.AudioSpecificConfig{
Type: 2,
SampleRate: 44100,
ChannelCount: 2,
ChannelConfig: 2,
ChannelCount: 2, //nolint:staticcheck
},
},
}
+1 -1
View File
@@ -182,7 +182,7 @@ func mediasFromAlwaysAvailableTracks(alwaysAvailableTracks []conf.AlwaysAvailabl
Type: mpeg4audio.ObjectTypeAACLC,
SampleRate: track.SampleRate,
ChannelConfig: uint8(track.ChannelCount),
ChannelCount: track.ChannelCount,
ChannelCount: track.ChannelCount, //nolint:staticcheck
},
}},
})
+2 -2
View File
@@ -520,7 +520,7 @@ func TestStreamAlwaysAvailable(t *testing.T) {
Type: 2,
SampleRate: 44100,
ChannelConfig: 2,
ChannelCount: 2,
ChannelCount: 2, //nolint:staticcheck
},
},
Samples: []*pmp4.Sample{
@@ -768,7 +768,7 @@ func TestStreamAlwaysAvailable(t *testing.T) {
Type: 2,
SampleRate: 44100,
ChannelConfig: 2,
ChannelCount: 2,
ChannelCount: 2, //nolint:staticcheck
},
}},
},
+1 -1
View File
@@ -46,7 +46,7 @@ var FormatMPEG4Audio = &format.MPEG4Audio{
Config: &mpeg4audio.AudioSpecificConfig{
Type: 2,
SampleRate: 44100,
ChannelCount: 2,
ChannelCount: 2, //nolint:staticcheck
ChannelConfig: 2,
},
SizeLength: 13,