Skip to content

Commit

Permalink
update golangci-lint (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 authored Mar 19, 2024
1 parent 059a8bc commit fa7c53f
Show file tree
Hide file tree
Showing 34 changed files with 40 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

- uses: golangci/golangci-lint-action@v3
with:
version: v1.55.2
version: v1.56.2

go-mod-tidy:
runs-on: ubuntu-20.04
Expand Down
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ linters:
- nilerr
- prealloc
- revive
- usestdlibvars
- unconvert
- tparallel
- wastedassign
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
BASE_IMAGE = golang:1.21-alpine3.18
LINT_IMAGE = golangci/golangci-lint:v1.55.2
LINT_IMAGE = golangci/golangci-lint:v1.56.2

.PHONY: $(shell ls)

Expand Down
2 changes: 1 addition & 1 deletion pkg/codecs/ac3/bsi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestBSIUnmarshal(t *testing.T) {
}

func FuzzBSIUnmarshal(f *testing.F) {
f.Fuzz(func(t *testing.T, b []byte) {
f.Fuzz(func(_ *testing.T, b []byte) {
var bsi BSI
bsi.Unmarshal(b) //nolint:errcheck
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/codecs/ac3/sync_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ func TestSyncInfoUnmarshal(t *testing.T) {
}

func FuzzSyncInfoUnmarshal(f *testing.F) {
f.Fuzz(func(t *testing.T, b []byte) {
f.Fuzz(func(_ *testing.T, b []byte) {
var syncInfo SyncInfo
syncInfo.Unmarshal(b) //nolint:errcheck
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/codecs/av1/bitstream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestBitstreamMarshal(t *testing.T) {
}

func FuzzBitstreamUnmarshal(f *testing.F) {
f.Fuzz(func(t *testing.T, b []byte) {
f.Fuzz(func(_ *testing.T, b []byte) {
BitstreamUnmarshal(b, true) //nolint:errcheck
})
}
2 changes: 1 addition & 1 deletion pkg/codecs/av1/leb128_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func TestLEB128Marshal(t *testing.T) {
}

func FuzzLEB128Unmarshal(f *testing.F) {
f.Fuzz(func(t *testing.T, b []byte) {
f.Fuzz(func(_ *testing.T, b []byte) {
LEB128Unmarshal(b) //nolint:errcheck
})
}
2 changes: 1 addition & 1 deletion pkg/codecs/av1/obu_header_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestOBUHeaderUnmarshal(t *testing.T) {
}

func FuzzOBUHeaderUnmarshal(f *testing.F) {
f.Fuzz(func(t *testing.T, b []byte) {
f.Fuzz(func(_ *testing.T, b []byte) {
var h OBUHeader
h.Unmarshal(b) //nolint:errcheck
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/codecs/av1/sequence_header_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func TestSequenceHeaderUnmarshal(t *testing.T) {
}

func FuzzSequenceHeaderUnmarshal(f *testing.F) {
f.Fuzz(func(t *testing.T, b []byte) {
f.Fuzz(func(_ *testing.T, b []byte) {
var sh SequenceHeader
sh.Unmarshal(b) //nolint:errcheck
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/codecs/h264/annexb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func BenchmarkAnnexBUnmarshal(b *testing.B) {
}

func FuzzAnnexBUnmarshal(f *testing.F) {
f.Fuzz(func(t *testing.T, b []byte) {
f.Fuzz(func(_ *testing.T, b []byte) {
AnnexBUnmarshal(b) //nolint:errcheck
})
}
2 changes: 1 addition & 1 deletion pkg/codecs/h264/avcc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func TestAVCCMarshal(t *testing.T) {
}

func FuzzAVCCUnmarshal(f *testing.F) {
f.Fuzz(func(t *testing.T, b []byte) {
f.Fuzz(func(_ *testing.T, b []byte) {
AVCCUnmarshal(b) //nolint:errcheck
})
}
2 changes: 1 addition & 1 deletion pkg/codecs/h264/dts_extractor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ func TestDTSExtractor(t *testing.T) {

func FuzzDTSExtractor(f *testing.F) {
ex := NewDTSExtractor()
f.Fuzz(func(t *testing.T, b []byte, p uint64) {
f.Fuzz(func(_ *testing.T, b []byte, p uint64) {
if len(b) < 1 {
return
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/codecs/h264/emulation_prevention_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestEmulationPreventionRemove(t *testing.T) {
}

func FuzzEmulationPreventionRemove(f *testing.F) {
f.Fuzz(func(t *testing.T, b []byte) {
f.Fuzz(func(_ *testing.T, b []byte) {
EmulationPreventionRemove(b)
})
}
2 changes: 1 addition & 1 deletion pkg/codecs/h264/sps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ func BenchmarkSPSUnmarshal(b *testing.B) {
}

func FuzzSPSUnmarshal(f *testing.F) {
f.Fuzz(func(t *testing.T, b []byte) {
f.Fuzz(func(_ *testing.T, b []byte) {
var sps SPS
sps.Unmarshal(b) //nolint:errcheck
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/codecs/h265/dts_extractor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func FuzzDTSExtractor(f *testing.F) {
}

ex := NewDTSExtractor()
f.Fuzz(func(t *testing.T, b []byte, p uint64) {
f.Fuzz(func(_ *testing.T, b []byte, p uint64) {
if len(b) < 1 {
return
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/codecs/h265/pps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TestPPSUnmarshal(t *testing.T) {
}

func FuzzPPSUnmarshal(f *testing.F) {
f.Fuzz(func(t *testing.T, b []byte) {
f.Fuzz(func(_ *testing.T, b []byte) {
var pps PPS
pps.Unmarshal(b) //nolint:errcheck
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/codecs/h265/sps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ func TestSPSUnmarshal(t *testing.T) {
}

func FuzzSPSUnmarshal(f *testing.F) {
f.Fuzz(func(t *testing.T, b []byte) {
f.Fuzz(func(_ *testing.T, b []byte) {
var sps SPS
sps.Unmarshal(b) //nolint:errcheck
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/codecs/jpeg/define_quantization_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func TestDefineQuantizationTableMarshal(t *testing.T) {
}

func FuzzDefineQuantizationTableUnmarshal(f *testing.F) {
f.Fuzz(func(t *testing.T, b []byte) {
f.Fuzz(func(_ *testing.T, b []byte) {
var h DefineQuantizationTable
h.Unmarshal(b) //nolint:errcheck
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/codecs/jpeg/define_restart_interval_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestDefineRestartIntervalUnmarshal(t *testing.T) {
}

func FuzzDefineRestartIntervalUnmarshal(f *testing.F) {
f.Fuzz(func(t *testing.T, b []byte) {
f.Fuzz(func(_ *testing.T, b []byte) {
var h DefineRestartInterval
h.Unmarshal(b) //nolint:errcheck
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/codecs/jpeg/start_of_frame1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestStartOfFrame1Marshal(t *testing.T) {
}

func FuzzStartOfFrame1Unmarshal(f *testing.F) {
f.Fuzz(func(t *testing.T, b []byte) {
f.Fuzz(func(_ *testing.T, b []byte) {
var h StartOfFrame1
h.Unmarshal(b) //nolint:errcheck
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/codecs/jpeg/start_of_scan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestStartOfScanMarshal(t *testing.T) {
}

func FuzzStartOfScanUnmarshal(f *testing.F) {
f.Fuzz(func(t *testing.T, b []byte) {
f.Fuzz(func(_ *testing.T, b []byte) {
var h StartOfScan
h.Unmarshal(b) //nolint:errcheck
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/codecs/mpeg1audio/frame_header_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func TestFrameHeaderUnmarshal(t *testing.T) {
}

func FuzzFrameHeaderUnmarshal(f *testing.F) {
f.Fuzz(func(t *testing.T, b []byte) {
f.Fuzz(func(_ *testing.T, b []byte) {
var h FrameHeader
h.Unmarshal(b) //nolint:errcheck
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/codecs/mpeg4audio/adts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func TestADTSMarshal(t *testing.T) {
}

func FuzzADTSUnmarshal(f *testing.F) {
f.Fuzz(func(t *testing.T, b []byte) {
f.Fuzz(func(_ *testing.T, b []byte) {
var pkts ADTSPackets
pkts.Unmarshal(b) //nolint:errcheck
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/codecs/mpeg4audio/audio_specific_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func TestAudioSpecificConfigMarshalErrors(t *testing.T) {
}

func FuzzAudioSpecificConfigUnmarshal(f *testing.F) {
f.Fuzz(func(t *testing.T, b []byte) {
f.Fuzz(func(_ *testing.T, b []byte) {
var conf AudioSpecificConfig
conf.Unmarshal(b) //nolint:errcheck
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/codecs/mpeg4audio/stream_mux_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func TestStreamMuxConfigMarshal(t *testing.T) {
}

func FuzzStreamMuxConfigUnmarshal(f *testing.F) {
f.Fuzz(func(t *testing.T, b []byte) {
f.Fuzz(func(_ *testing.T, b []byte) {
var conf StreamMuxConfig
conf.Unmarshal(b) //nolint:errcheck
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/codecs/mpeg4video/is_valid_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestIsValidConfig(t *testing.T) {
}

func FuzzIsValidConfig(f *testing.F) {
f.Fuzz(func(t *testing.T, b []byte) {
f.Fuzz(func(_ *testing.T, b []byte) {
IsValidConfig(b) //nolint:errcheck
})
}
2 changes: 1 addition & 1 deletion pkg/codecs/opus/packet_duration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestPacketDuration(t *testing.T) {
}

func FuzzPacketDuration(f *testing.F) {
f.Fuzz(func(t *testing.T, b []byte) {
f.Fuzz(func(_ *testing.T, b []byte) {
PacketDuration(b)
})
}
2 changes: 1 addition & 1 deletion pkg/codecs/vp9/header_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func TestHeaderUnmarshal(t *testing.T) {
}

func FuzzHeaderUnmarshal(f *testing.F) {
f.Fuzz(func(t *testing.T, b []byte) {
f.Fuzz(func(_ *testing.T, b []byte) {
var sh Header
sh.Unmarshal(b) //nolint:errcheck
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/formats/fmp4/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2132,7 +2132,7 @@ func FuzzInitUnmarshal(f *testing.F) {
f.Add(ca.enc)
}

f.Fuzz(func(t *testing.T, b []byte) {
f.Fuzz(func(_ *testing.T, b []byte) {
var init Init
init.Unmarshal(bytes.NewReader(b)) //nolint:errcheck
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/formats/fmp4/parts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func FuzzPartsUnmarshal(f *testing.F) {
f.Add(ca.enc)
}

f.Fuzz(func(t *testing.T, b []byte) {
f.Fuzz(func(_ *testing.T, b []byte) {
var parts Parts
parts.Unmarshal(b) //nolint:errcheck
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/formats/mpegts/opus_access_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func TestOpusAccessUnitUnmarshal(t *testing.T) {
}

func FuzzOpusAccessUnitUnmarshal(f *testing.F) {
f.Fuzz(func(t *testing.T, b []byte) {
f.Fuzz(func(_ *testing.T, b []byte) {
var h opusAccessUnit
h.unmarshal(b) //nolint:errcheck
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/formats/mpegts/opus_control_header_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func TestOpusControlHeaderUnmarshal(t *testing.T) {
}

func FuzzOpusControlHeaderUnmarshal(f *testing.F) {
f.Fuzz(func(t *testing.T, b []byte) {
f.Fuzz(func(_ *testing.T, b []byte) {
var h opusControlHeader
h.unmarshal(b) //nolint:errcheck
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/formats/mpegts/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (r *Reader) OnDataH26x(track *Track, cb ReaderOnDataH26xFunc) {

// OnDataMPEGxVideo sets a callback that is called when data from an MPEG-1/2/4 Video track is received.
func (r *Reader) OnDataMPEGxVideo(track *Track, cb ReaderOnDataMPEGxVideoFunc) {
r.onData[track.PID] = func(pts int64, dts int64, data []byte) error {
r.onData[track.PID] = func(pts int64, _ int64, data []byte) error {
return cb(pts, data)
}
}
Expand Down
14 changes: 7 additions & 7 deletions pkg/formats/mpegts/reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1234,33 +1234,33 @@ func TestReaderDecodeErrors(t *testing.T) {

switch ca {
case "missing pts", "h26x invalid avcc":
r.OnDataH26x(r.Tracks()[0], func(pts, dts int64, au [][]byte) error {
r.OnDataH26x(r.Tracks()[0], func(_, _ int64, _ [][]byte) error {
return nil
})

case "opus pts != dts", "opus invalid au":
r.OnDataOpus(r.Tracks()[0], func(pts int64, packets [][]byte) error {
r.OnDataOpus(r.Tracks()[0], func(_ int64, _ [][]byte) error {
return nil
})

case "mpeg-4 audio pts != dts", "mpeg-4 audio invalid":
r.OnDataMPEG4Audio(r.Tracks()[0], func(pts int64, aus [][]byte) error {
r.OnDataMPEG4Audio(r.Tracks()[0], func(_ int64, _ [][]byte) error {
return nil
})

case "mpeg-1 audio pts != dts":
r.OnDataMPEG1Audio(r.Tracks()[0], func(pts int64, aus [][]byte) error {
r.OnDataMPEG1Audio(r.Tracks()[0], func(_ int64, _ [][]byte) error {
return nil
})

case "ac-3 pts != dts":
r.OnDataAC3(r.Tracks()[0], func(pts int64, frame []byte) error {
r.OnDataAC3(r.Tracks()[0], func(_ int64, _ []byte) error {
return nil
})

case "garbage":
counter := 0
r.OnDataH26x(r.Tracks()[0], func(pts, dts int64, au [][]byte) error {
r.OnDataH26x(r.Tracks()[0], func(_, _ int64, _ [][]byte) error {
counter++
if counter == 2 {
dataRecv = true
Expand Down Expand Up @@ -1423,7 +1423,7 @@ func FuzzReader(f *testing.F) {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
})

f.Fuzz(func(t *testing.T, b []byte) {
f.Fuzz(func(_ *testing.T, b []byte) {
NewReader(bytes.NewReader(b)) //nolint:errcheck
})
}

0 comments on commit fa7c53f

Please sign in to comment.