Skip to content

Fix golangci-lint configuration #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

peczenyj
Copy link
Collaborator

@peczenyj peczenyj commented May 29, 2025

Here I am assuming that we supposed to run golangci-lint version 1

If I try to run golangci-lint with current .golangci.yml file I got some warnings

WARN [config_reader] The configuration option `run.skip-files` is deprecated, please use `issues.exclude-files`. 
WARN [config_reader] The configuration option `run.skip-dirs` is deprecated, please use `issues.exclude-dirs`. 
WARN [config_reader] The configuration option `linters.govet.check-shadowing` is deprecated. Please enable `shadow` instead, if you are not using `enable-all`. 

If I try to validate the configuration with golangci-lint config verify I got:

jsonschema: "run" does not validate with "/properties/run/additionalProperties": additional properties 'skip-dirs', 'skip-files' not allowed
jsonschema: "linters-settings.govet" does not validate with "/properties/linters-settings/properties/govet/additionalProperties": additional properties 'check-shadowing' not allowed
jsonschema: "" does not validate with "/additionalProperties": additional properties 'service' not allowed
Failed executing command with error: the configuration contains invalid elements

I try to fix the warnings and remove the invalid properties

I check with yamllint and the file is valid (remove some trailing spaces etc)

now it is possible migrate to golangci-lint v2

BTW it is important to know... there are several lint issues

@peczenyj peczenyj changed the title Fix golangci lint Fix golangci-lint configuration May 29, 2025
@peczenyj
Copy link
Collaborator Author

golangci-lint output on my machine, using latest version (1.64.8)

internal/ingestion/resolution/h264_parser.go:164:4: ineffectual assignment to maxMatrices (ineffassign)
			maxMatrices := 8
			^
internal/ingestion/frame/bframe_reorderer.go:123:12: Error return value is not checked (errcheck)
		frame := heap.Pop(&r.buffer).(*types.VideoFrame)
		         ^
internal/ingestion/frame/bframe_reorderer.go:254:12: Error return value is not checked (errcheck)
		frame := heap.Pop(&r.buffer).(*types.VideoFrame)
		         ^
internal/ingestion/frame/bframe_reorderer.go:332:18: Error return value is not checked (errcheck)
	*h = append(*h, x.(*types.VideoFrame))
	                ^
internal/ingestion/frame/assembler_output_test.go:256:4: ineffectual assignment to err (ineffassign)
			err = assembler.AddPacket(pkt) // This should succeed (buffer has room)
			^
internal/ingestion/memory/controller.go:126:10: Error return value is not checked (errcheck)
		return val.(*atomic.Int64)
		       ^
internal/ingestion/memory/controller.go:135:10: Error return value is not checked (errcheck)
		return val.(*atomic.Int64)
		       ^
internal/ingestion/memory/controller.go:148:12: Error return value is not checked (errcheck)
		usage := streamUsage.(*atomic.Int64)
		         ^
internal/ingestion/memory/controller.go:176:12: Error return value is not checked (errcheck)
		usage := streamUsage.(*atomic.Int64)
		         ^
internal/ingestion/memory/controller.go:192:15: Error return value is not checked (errcheck)
		streamID := key.(string)
		            ^
internal/ingestion/memory/controller.go:193:12: Error return value is not checked (errcheck)
		usage := value.(*atomic.Int64).Load()
		         ^
internal/ingestion/memory/controller.go:225:15: Error return value is not checked (errcheck)
		streamID := key.(string)
		            ^
internal/ingestion/memory/controller.go:226:12: Error return value is not checked (errcheck)
		usage := value.(*atomic.Int64).Load()
		         ^
internal/ingestion/memory/controller.go:246:14: Error return value is not checked (errcheck)
				usage := streamUsage.(*atomic.Int64).Load()
				         ^
internal/ingestion/memory/controller.go:260:12: Error return value is not checked (errcheck)
		usage := streamUsage.(*atomic.Int64)
		         ^
internal/ingestion/recovery/recovery.go:345:18: Error return value is not checked (errcheck)
	lastRecovery := h.lastRecoveryTime.Load().(time.Time)
	                ^
internal/ingestion/recovery/recovery.go:376:9: Error return value is not checked (errcheck)
	return h.state.Load().(RecoveryState)
	       ^
internal/ingestion/recovery/recovery.go:398:18: Error return value is not checked (errcheck)
	lastRecovery := h.lastRecoveryTime.Load().(time.Time)
	                ^
internal/ingestion/recovery/smart_recovery.go:149:16: Error return value of `h.HandleError` is not checked (errcheck)
		h.HandleError(ErrorTypeCorruption, "preemptive_recovery")
		             ^
internal/ingestion/recovery/smart_recovery.go:479:16: Error return value of `h.HandleError` is not checked (errcheck)
		h.HandleError(ErrorTypeTimeout, "keyframe_timeout")
		             ^
internal/ingestion/types/parameter_cache.go:120:11: Error return value is not checked (errcheck)
		item := oldest.Value.(*cacheItem)
		        ^
internal/ingestion/types/parameter_cache.go:142:13: Error return value is not checked (errcheck)
				item := elem.Value.(*cacheItem)
				        ^
internal/ingestion/buffer/pool.go:42:10: Error return value is not checked (errcheck)
		return buf.(*RingBuffer)
		       ^
internal/ingestion/buffer/pool.go:52:10: Error return value is not checked (errcheck)
		return buf.(*RingBuffer)
		       ^
internal/ingestion/buffer/pool.go:100:13: Error return value is not checked (errcheck)
		buffer := buf.(*RingBuffer)
		          ^
internal/ingestion/buffer/pool.go:123:13: Error return value is not checked (errcheck)
		buffer := value.(*RingBuffer)
		          ^
internal/ingestion/backpressure/controller.go:160:2: ineffectual assignment to pressure (ineffassign)
	pressure := currentPressure
	^
internal/queue/hybrid_queue_recovery_test.go:337:3: ineffectual assignment to err (ineffassign)
		err = q.Enqueue([]byte("should_fail"))
		^
internal/ingestion/rtp/listener.go:202:29: Error return value of `l.rtpConn.SetReadDeadline` is not checked (errcheck)
			l.rtpConn.SetReadDeadline(time.Now().Add(time.Second))
			                         ^
internal/ingestion/rtp/listener.go:423:30: Error return value of `l.rtcpConn.SetReadDeadline` is not checked (errcheck)
			l.rtcpConn.SetReadDeadline(time.Now().Add(time.Second))
			                          ^
internal/ingestion/rtp/session.go:277:22: Error return value of `s.registry.Update` is not checked (errcheck)
				s.registry.Update(s.ctx, stream)
				                 ^
internal/ingestion/rtp/session.go:575:28: Error return value of `s.registry.UpdateStatus` is not checked (errcheck)
				s.registry.UpdateStatus(s.ctx, s.streamID, registry.StatusError)
				                       ^
internal/ingestion/rtp/session.go:615:28: Error return value of `s.registry.UpdateStatus` is not checked (errcheck)
				s.registry.UpdateStatus(s.ctx, s.streamID, registry.StatusError)
				                       ^
internal/ingestion/rtp/session.go:641:23: Error return value of `s.registry.Update` is not checked (errcheck)
					s.registry.Update(s.ctx, stream)
					                 ^
internal/ingestion/srt/connection.go:106:25: Error return value of `c.registry.Unregister` is not checked (errcheck)
			c.registry.Unregister(context.Background(), c.streamID)
			                     ^
internal/ingestion/srt/listener.go:159:25: Error return value of `socket.SetRejectReason` is not checked (errcheck)
		socket.SetRejectReason(RejectionReasonBadRequest)
		                      ^
internal/ingestion/srt/listener.go:169:25: Error return value of `socket.SetRejectReason` is not checked (errcheck)
		socket.SetRejectReason(RejectionReasonResourceUnavailable)
		                      ^
internal/ingestion/srt/listener.go:179:25: Error return value of `socket.SetRejectReason` is not checked (errcheck)
		socket.SetRejectReason(RejectionReasonResourceUnavailable)
		                      ^
internal/ingestion/srt/listener.go:275:15: Error return value is not checked (errcheck)
		streamID := key.(string)
		            ^
internal/ingestion/srt/listener.go:276:11: Error return value is not checked (errcheck)
		conn := value.(*Connection)
		        ^
tests/helpers.go:229:9: Error return value is not checked (errcheck)
	return listener.Addr().(*net.TCPAddr).Port, nil
	       ^
internal/ingestion/api_handlers_video.go:50:9: Error return value of `w.Write` is not checked (errcheck)
	w.Write([]byte(header))
	       ^
internal/ingestion/api_handlers_video.go:53:9: Error return value of `w.Write` is not checked (errcheck)
	w.Write(previewData)
	       ^
internal/ingestion/api_handlers_video.go:436:12: Error return value of `w.Write` is not checked (errcheck)
				w.Write(jpegData)
				       ^
internal/ingestion/api_handlers_video.go:445:8: Error return value is not checked (errcheck)
			len(sessionStats["sps_ids"].([]uint8)),
			    ^
internal/ingestion/api_handlers_video.go:447:8: Error return value is not checked (errcheck)
			len(sessionStats["pps_ids"].([]uint8)),
			    ^
internal/ingestion/api_handlers_video.go:499:9: Error return value of `w.Write` is not checked (errcheck)
	w.Write(jpegData)
	       ^
internal/ingestion/api_handlers_video.go:547:13: Error return value is not checked (errcheck)
		SPSIDs:   sessionStats["sps_ids"].([]uint8),
		          ^
internal/ingestion/api_handlers_video.go:548:13: Error return value is not checked (errcheck)
		PPSIDs:   sessionStats["pps_ids"].([]uint8),
		          ^
internal/ingestion/manager.go:152:23: Error return value of `m.srtListener.Stop` is not checked (errcheck)
				m.srtListener.Stop()
				                  ^
internal/ingestion/manager.go:594:15: Error return value of `handler.Stop` is not checked (errcheck)
		handler.Stop()
		            ^
internal/ingestion/manager.go:676:25: Error return value of `m.registry.Unregister` is not checked (errcheck)
			m.registry.Unregister(context.Background(), streamID)
			                     ^
internal/ingestion/stream_handler.go:1383:32: Error return value of `h.recoveryHandler.HandleError` is not checked (errcheck)
		h.recoveryHandler.HandleError(recovery.ErrorTypeSequenceGap, gap)
		                             ^
internal/ingestion/stream_handler.go:1399:32: Error return value of `h.recoveryHandler.HandleError` is not checked (errcheck)
		h.recoveryHandler.HandleError(recovery.ErrorTypeTimestampJump, jump)
		                             ^
internal/ingestion/manager_test.go:409:2: ineffectual assignment to manager (ineffassign)
	manager, mr := setupTestManager(t)
	^
internal/ingestion/gop/buffer.go:242:11: Error return value is not checked (errcheck)
			gop := front.Value.(*types.GOP)
			       ^
internal/ingestion/gop/buffer.go:259:9: Error return value is not checked (errcheck)
	gop := front.Value.(*types.GOP)
	       ^
internal/ingestion/gop/buffer.go:281:18: Error return value is not checked (errcheck)
		b.oldestTime = b.gops.Front().Value.(*types.GOP).StartTime
		               ^
internal/ingestion/gop/buffer.go:299:10: Error return value is not checked (errcheck)
		return elem.Value.(*types.GOP)
		       ^
internal/ingestion/gop/buffer.go:326:27: Error return value is not checked (errcheck)
		result = append(result, elem.Value.(*types.GOP))
		                        ^
internal/ingestion/gop/buffer.go:389:10: Error return value is not checked (errcheck)
		gop := elem.Value.(*types.GOP)
		       ^
internal/ingestion/gop/buffer.go:435:10: Error return value is not checked (errcheck)
		gop := elem.Value.(*types.GOP)
		       ^
internal/ingestion/gop/buffer.go:476:10: Error return value is not checked (errcheck)
		gop := front.Value.(*types.GOP)
		       ^
internal/ingestion/gop/buffer.go:533:10: Error return value is not checked (errcheck)
		gop := elem.Value.(*types.GOP)
		       ^
internal/ingestion/gop/buffer.go:569:10: Error return value is not checked (errcheck)
		gop := elem.Value.(*types.GOP)
		       ^
internal/ingestion/gop/buffer.go:621:10: Error return value is not checked (errcheck)
		gop := elem.Value.(*types.GOP)
		       ^
internal/ingestion/gop/buffer.go:743:9: Error return value is not checked (errcheck)
	gop := elem.Value.(*types.GOP)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant