Skip to content

Commit 6668b0f

Browse files
committed
feat: upgrade linter and fix lint
1 parent 7f17786 commit 6668b0f

File tree

9 files changed

+8
-32
lines changed

9 files changed

+8
-32
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
NAME = stream-cli
22

3-
GOLANGCI_VERSION = 1.55.2
3+
GOLANGCI_VERSION = 1.62.2
44
GOLANGCI = .bin/golangci/$(GOLANGCI_VERSION)/golangci-lint
55
$(GOLANGCI):
66
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(dir $(GOLANGCI)) v$(GOLANGCI_VERSION)

pkg/cmd/chat/channel/channel.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ func hideCmd() *cobra.Command {
551551
return err
552552
}
553553

554-
cmd.Printf("Successfully hid channel for " + userID + "\n")
554+
cmd.Printf("Successfully hid channel for %s\n", userID)
555555
return nil
556556
},
557557
}

pkg/cmd/raw-recording/mix_audio.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func runMixAudio(cmd *cobra.Command, args []string) error {
7070

7171
// Mix all audio tracks
7272
mixer := processing.NewAudioMixer(logger)
73-
mixer.MixAllAudioTracks(&processing.AudioMixerConfig{
73+
_, _ = mixer.MixAllAudioTracks(&processing.AudioMixerConfig{
7474
WorkDir: globalArgs.WorkDir,
7575
OutputDir: globalArgs.Output,
7676
WithScreenshare: true,

pkg/cmd/raw-recording/process_all.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ func runProcessAll(cmd *cobra.Command, args []string) error {
143143

144144
// Mix all audio tracks
145145
mixer := processing.NewAudioMixer(logger)
146-
mixer.MixAllAudioTracks(&processing.AudioMixerConfig{
146+
_, _ = mixer.MixAllAudioTracks(&processing.AudioMixerConfig{
147147
WorkDir: globalArgs.WorkDir,
148148
OutputDir: globalArgs.Output,
149149
WithScreenshare: false,

pkg/cmd/raw-recording/processing/container_converter.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ type RTPDump2WebMConverter struct {
2727
recorder WebmRecorder
2828
sampleBuilder *samplebuilder.SampleBuilder
2929

30-
firstPkt *rtp.Packet
3130
lastPkt *rtp.Packet
3231
lastPktDuration uint32
3332
dtxInserted uint64
@@ -341,10 +340,6 @@ func opusFrameCount(c byte, payload []byte) int {
341340
return 0
342341
}
343342

344-
func (c *RTPDump2WebMConverter) offset(pts, fts uint32) int64 {
345-
return int64(c.timestampDiff(pts, fts) / 90)
346-
}
347-
348343
func (c *RTPDump2WebMConverter) timestampDiff(pts, fts uint32) uint32 {
349344
return pts - fts
350345
}

pkg/cmd/raw-recording/processing/ffmpeg_helper.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,9 @@ func runFFmpegCommand(args []string, logger *ProcessingLogger) error {
198198

199199
if err != nil {
200200
logger.Errorf("FFmpeg process pid<%d> failed: %v", cmd.Process.Pid, err)
201-
return fmt.Errorf("FFmpeg process pid<%d> failed in %s: %w", cmd.Process.Pid, time.Now().Sub(startAt).Round(time.Millisecond), err)
201+
return fmt.Errorf("FFmpeg process pid<%d> failed in %s: %w", cmd.Process.Pid, time.Since(startAt).Round(time.Millisecond), err)
202202
}
203203

204-
logger.Infof("FFmpeg process pid<%d> ended successfully in %s", cmd.Process.Pid, time.Now().Sub(startAt).Round(time.Millisecond))
204+
logger.Infof("FFmpeg process pid<%d> ended successfully in %s", cmd.Process.Pid, time.Since(startAt).Round(time.Millisecond))
205205
return nil
206206
}

pkg/cmd/raw-recording/processing/gstreamer_converter.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,14 +248,14 @@ func (r *GstreamerConverter) Close() error {
248248

249249
select {
250250
case <-time.After(5 * time.Second):
251-
r.logger.Warnf("GStreamer process pid<%d> termination timeout in %s...", r.gstreamerCmd.Process.Pid, time.Now().Sub(r.startAt).Round(time.Millisecond))
251+
r.logger.Warnf("GStreamer process pid<%d> termination timeout in %s...", r.gstreamerCmd.Process.Pid, time.Since(r.startAt).Round(time.Millisecond))
252252

253253
// Timeout, force kill
254254
if e := r.gstreamerCmd.Process.Kill(); e != nil {
255255
r.logger.Errorf("GStreamer process pid<%d> errored while killing: %v", r.gstreamerCmd.Process.Pid, e)
256256
}
257257
case <-done:
258-
r.logger.Infof("GStreamer process pid<%d> exited succesfully in %s...", r.gstreamerCmd.Process.Pid, time.Now().Sub(r.startAt).Round(time.Millisecond))
258+
r.logger.Infof("GStreamer process pid<%d> exited succesfully in %s...", r.gstreamerCmd.Process.Pid, time.Since(r.startAt).Round(time.Millisecond))
259259
}
260260
}
261261

pkg/cmd/raw-recording/processing/sdp_tool.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,6 @@ func readSDP(sdpFilePath string) (string, error) {
1616
return string(content), nil
1717
}
1818

19-
func replaceSDP(sdpContent string, port int) string {
20-
lines := strings.Split(sdpContent, "\n")
21-
for i, line := range lines {
22-
if strings.HasPrefix(line, "m=") {
23-
// Parse the m= line: m=<media_type> <port> RTP/AVP <payload_type>
24-
parts := strings.Fields(line)
25-
if len(parts) >= 4 {
26-
// Replace the port (second field)
27-
parts[1] = fmt.Sprintf("%d", port)
28-
lines[i] = strings.Join(parts, " ")
29-
break
30-
}
31-
}
32-
}
33-
return strings.Join(lines, "\n")
34-
}
35-
3619
func mimeType(sdp string) (string, error) {
3720
upper := strings.ToUpper(sdp)
3821
if strings.Contains(upper, "VP9") {

test/helpers.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"math/rand"
77
"os"
88
"testing"
9-
"time"
109

1110
stream "github.com/GetStream/stream-chat-go/v5"
1211
"github.com/spf13/cobra"
@@ -91,7 +90,6 @@ func DeleteMessage(id string) {
9190
}
9291

9392
func RandomString(n int) string {
94-
rand.Seed(time.Now().UnixNano())
9593
bytes := make([]byte, n)
9694
for i := 0; i < n; i++ {
9795
bytes[i] = byte(65 + rand.Intn(25)) // A=65 and Z = 65+25

0 commit comments

Comments
 (0)