bump golangci-lint (#4550)

This commit is contained in:
Alessandro Ros
2025-05-23 15:10:21 +02:00
committed by GitHub
parent e707a9237d
commit fad64a87bd
22 changed files with 77 additions and 75 deletions
+2 -2
View File
@@ -21,9 +21,9 @@ jobs:
- run: go generate ./...
- uses: golangci/golangci-lint-action@v4
- uses: golangci/golangci-lint-action@v8
with:
version: v1.61.0
version: v2.1.6
mod_tidy:
runs-on: ubuntu-22.04
+51 -49
View File
@@ -1,73 +1,75 @@
version: "2"
linters:
enable:
- asciicheck
- bidichk
- bodyclose
#- contextcheck
- copyloopvar
- dupl
- errorlint
- gochecknoinits
- gocritic
- gofmt
- gofumpt
- lll
- misspell
- nilerr
- prealloc
- predeclared
- reassign
- revive
- usestdlibvars
- unconvert
#- usetesting
- tparallel
- wastedassign
- whitespace
issues:
exclude-use-default: false
settings:
errcheck:
exclude-functions:
- io.Copy
- (io.Closer).Close
- (io.Writer).Write
- (hash.Hash).Write
- (net.Conn).Close
- (net.Conn).SetReadDeadline
- (net.Conn).SetWriteDeadline
- (*net.TCPConn).SetKeepAlive
- (*net.TCPConn).SetKeepAlivePeriod
- (*net.TCPConn).SetNoDelay
- (net.Listener).Close
- (net.PacketConn).Close
- (net.PacketConn).SetReadDeadline
- (net.PacketConn).SetWriteDeadline
- (net/http.ResponseWriter).Write
- (*net/http.Server).Serve
- (*net/http.Server).ServeTLS
- (*net/http.Server).Shutdown
- os.Chdir
- os.Mkdir
- os.MkdirAll
- os.Remove
- os.RemoveAll
- os.Setenv
- os.Unsetenv
- (*os.File).WriteString
- (*os.File).Close
- (github.com/datarhei/gosrt.Conn).Close
- (github.com/datarhei/gosrt.Conn).SetReadDeadline
- (github.com/datarhei/gosrt.Conn).SetWriteDeadline
- (*github.com/bluenviron/gortsplib/v4.Client).Close
- (*github.com/bluenviron/gortsplib/v4.Server).Close
- (*github.com/bluenviron/gortsplib/v4.ServerSession).Close
- (*github.com/bluenviron/gortsplib/v4.ServerStream).Close
- (*github.com/bluenviron/gortsplib/v4.ServerConn).Close
linters-settings:
errcheck:
exclude-functions:
- io.Copy
- (io.Closer).Close
- (io.Writer).Write
- (hash.Hash).Write
- (net.Conn).Close
- (net.Conn).SetReadDeadline
- (net.Conn).SetWriteDeadline
- (*net.TCPConn).SetKeepAlive
- (*net.TCPConn).SetKeepAlivePeriod
- (*net.TCPConn).SetNoDelay
- (net.Listener).Close
- (net.PacketConn).Close
- (net.PacketConn).SetReadDeadline
- (net.PacketConn).SetWriteDeadline
- (net/http.ResponseWriter).Write
- (*net/http.Server).Serve
- (*net/http.Server).ServeTLS
- (*net/http.Server).Shutdown
- os.Chdir
- os.Mkdir
- os.MkdirAll
- os.Remove
- os.RemoveAll
- os.Setenv
- os.Unsetenv
- (*os.File).WriteString
- (*os.File).Close
- (github.com/datarhei/gosrt.Conn).Close
- (github.com/datarhei/gosrt.Conn).SetReadDeadline
- (github.com/datarhei/gosrt.Conn).SetWriteDeadline
- (*github.com/bluenviron/gortsplib/v4.Client).Close
- (*github.com/bluenviron/gortsplib/v4.Server).Close
- (*github.com/bluenviron/gortsplib/v4.ServerSession).Close
- (*github.com/bluenviron/gortsplib/v4.ServerStream).Close
- (*github.com/bluenviron/gortsplib/v4.ServerConn).Close
govet:
enable-all: true
disable:
- fieldalignment
- reflectvaluecompare
govet:
enable-all: true
disable:
- fieldalignment
- reflectvaluecompare
formatters:
enable:
- gofmt
- gofumpt
- goimports
+1 -1
View File
@@ -1,5 +1,5 @@
BASE_IMAGE = golang:1.23-alpine3.20
LINT_IMAGE = golangci/golangci-lint:v1.64.5
LINT_IMAGE = golangci/golangci-lint:v2.1.6
NODE_IMAGE = node:20-alpine3.20
.PHONY: $(shell ls)
+1 -1
View File
@@ -78,7 +78,7 @@ func (t *ac3) ProcessRTPPacket( //nolint:dupl
}
// remove padding
pkt.Header.Padding = false
pkt.Padding = false
pkt.PaddingSize = 0
if pkt.MarshalSize() > t.UDPMaxPayloadSize {
+1 -1
View File
@@ -86,7 +86,7 @@ func (t *av1) ProcessRTPPacket( //nolint:dupl
}
// remove padding
pkt.Header.Padding = false
pkt.Padding = false
pkt.PaddingSize = 0
if pkt.MarshalSize() > t.UDPMaxPayloadSize {
+1 -1
View File
@@ -80,7 +80,7 @@ func (t *g711) ProcessRTPPacket( //nolint:dupl
}
// remove padding
pkt.Header.Padding = false
pkt.Padding = false
pkt.PaddingSize = 0
if pkt.MarshalSize() > t.UDPMaxPayloadSize {
+1 -1
View File
@@ -45,7 +45,7 @@ func (t *generic) ProcessRTPPacket(
}
// remove padding
pkt.Header.Padding = false
pkt.Padding = false
pkt.PaddingSize = 0
if pkt.MarshalSize() > t.UDPMaxPayloadSize {
+1 -1
View File
@@ -263,7 +263,7 @@ func (t *h264) ProcessRTPPacket( //nolint:dupl
if t.encoder == nil {
// remove padding
pkt.Header.Padding = false
pkt.Padding = false
pkt.PaddingSize = 0
// RTP packets exceed maximum size: start re-encoding them
+1 -1
View File
@@ -295,7 +295,7 @@ func (t *h265) ProcessRTPPacket( //nolint:dupl
if t.encoder == nil {
// remove padding
pkt.Header.Padding = false
pkt.Padding = false
pkt.PaddingSize = 0
// RTP packets exceed maximum size: start re-encoding them
+1 -1
View File
@@ -80,7 +80,7 @@ func (t *lpcm) ProcessRTPPacket( //nolint:dupl
}
// remove padding
pkt.Header.Padding = false
pkt.Padding = false
pkt.PaddingSize = 0
if pkt.MarshalSize() > t.UDPMaxPayloadSize {
+1 -1
View File
@@ -79,7 +79,7 @@ func (t *mjpeg) ProcessRTPPacket( //nolint:dupl
}
// remove padding
pkt.Header.Padding = false
pkt.Padding = false
pkt.PaddingSize = 0
if pkt.MarshalSize() > t.UDPMaxPayloadSize {
+1 -1
View File
@@ -78,7 +78,7 @@ func (t *mpeg1Audio) ProcessRTPPacket( //nolint:dupl
}
// remove padding
pkt.Header.Padding = false
pkt.Padding = false
pkt.PaddingSize = 0
if pkt.MarshalSize() > t.UDPMaxPayloadSize {
+1 -1
View File
@@ -88,7 +88,7 @@ func (t *mpeg1Video) ProcessRTPPacket( //nolint:dupl
}
// remove padding
pkt.Header.Padding = false
pkt.Padding = false
pkt.PaddingSize = 0
if pkt.MarshalSize() > t.UDPMaxPayloadSize {
+1 -1
View File
@@ -82,7 +82,7 @@ func (t *mpeg4Audio) ProcessRTPPacket( //nolint:dupl
}
// remove padding
pkt.Header.Padding = false
pkt.Padding = false
pkt.PaddingSize = 0
if pkt.MarshalSize() > t.UDPMaxPayloadSize {
+1 -1
View File
@@ -133,7 +133,7 @@ func (t *mpeg4Video) ProcessRTPPacket( //nolint:dupl
t.updateTrackParameters(pkt.Payload)
// remove padding
pkt.Header.Padding = false
pkt.Padding = false
pkt.PaddingSize = 0
if pkt.MarshalSize() > t.UDPMaxPayloadSize {
+1 -1
View File
@@ -86,7 +86,7 @@ func (t *opus) ProcessRTPPacket(
}
// remove padding
pkt.Header.Padding = false
pkt.Padding = false
pkt.PaddingSize = 0
if pkt.MarshalSize() > t.UDPMaxPayloadSize {
+1 -1
View File
@@ -79,7 +79,7 @@ func (t *vp8) ProcessRTPPacket( //nolint:dupl
}
// remove padding
pkt.Header.Padding = false
pkt.Padding = false
pkt.PaddingSize = 0
if pkt.MarshalSize() > t.UDPMaxPayloadSize {
+1 -1
View File
@@ -79,7 +79,7 @@ func (t *vp9) ProcessRTPPacket( //nolint:dupl
}
// remove padding
pkt.Header.Padding = false
pkt.Padding = false
pkt.PaddingSize = 0
if pkt.MarshalSize() > t.UDPMaxPayloadSize {
+1 -1
View File
@@ -27,7 +27,7 @@ func (d *destinationSysLog) log(t time.Time, level Level, format string, args ..
writeTime(&d.buf, t, false)
writeLevel(&d.buf, level, false)
writeContent(&d.buf, format, args)
d.syslog.Write(d.buf.Bytes())
d.syslog.Write(d.buf.Bytes()) //nolint:errcheck
}
func (d *destinationSysLog) close() {
+1 -1
View File
@@ -136,7 +136,7 @@ func writeLevel(buf *bytes.Buffer, level Level, useColor bool) {
}
func writeContent(buf *bytes.Buffer, format string, args []interface{}) {
buf.Write([]byte(fmt.Sprintf(format, args...)))
fmt.Fprintf(buf, format, args...)
buf.WriteByte('\n')
}
+1 -1
View File
@@ -157,7 +157,7 @@ func setupAudio(
return err
}
if !(!h.MPEG2 && h.Layer == 3) {
if h.MPEG2 || h.Layer != 3 {
return fmt.Errorf("RTMP only supports MPEG-1 layer 3 audio")
}
+5 -5
View File
@@ -91,11 +91,11 @@ func mpeg4AudioTrackFromConfig(data []byte) (*format.MPEG4Audio, error) {
}
func audioTrackFromData(msg *message.Audio) (format.Format, error) {
switch {
case msg.Codec == message.CodecMPEG1Audio:
switch msg.Codec {
case message.CodecMPEG1Audio:
return &format.MPEG1Audio{}, nil
case msg.Codec == message.CodecPCMA:
case message.CodecPCMA:
return &format.G711{
PayloadTyp: 8,
MULaw: false,
@@ -108,7 +108,7 @@ func audioTrackFromData(msg *message.Audio) (format.Format, error) {
}(),
}, nil
case msg.Codec == message.CodecPCMU:
case message.CodecPCMU:
return &format.G711{
PayloadTyp: 0,
MULaw: true,
@@ -121,7 +121,7 @@ func audioTrackFromData(msg *message.Audio) (format.Format, error) {
}(),
}, nil
case msg.Codec == message.CodecLPCM:
case message.CodecLPCM:
return &format.LPCM{
PayloadTyp: 96,
BitDepth: func() int {