Add golangci-lint config

This commit is contained in:
2026-02-12 02:54:35 +03:00
parent f22111aa43
commit 9e59fa18e4
14 changed files with 112 additions and 50 deletions

View File

@@ -52,11 +52,11 @@ func (t *Transcoder) Convert(sourcePath, destinationPath string) (int64, error)
analyzeOutput, err := sourceAnalyzeCmd.Output()
if err == nil {
// Investiage bit depth and sample rate from ffprobe output.
// Investigate bit depth and sample rate from ffprobe output.
// We need that to make sure we don't oversample files that are lower
// than the default sample rate and bit depth.
lines := strings.Split(strings.TrimSpace(string(analyzeOutput)), "\n")
for _, line := range lines {
lines := strings.SplitSeq(strings.TrimSpace(string(analyzeOutput)), "\n")
for line := range lines {
if strings.Contains(line, "audio") {
parts := strings.Split(line, ",")
if len(parts) >= 6 {
@@ -137,7 +137,7 @@ func (t *Transcoder) Convert(sourcePath, destinationPath string) (int64, error)
"-af", "aresample=48000:resampler=soxr:precision=28",
)
} else {
ffmpegArgs = append(ffmpegArgs, "-ar", fmt.Sprintf("%d", sampleRate))
ffmpegArgs = append(ffmpegArgs, "-ar", strconv.Itoa(sampleRate))
}
if needsBitReduce {
@@ -151,7 +151,7 @@ func (t *Transcoder) Convert(sourcePath, destinationPath string) (int64, error)
// Handle metadata copying and sort_artist filling
ffmpegArgs = append(ffmpegArgs,
"-map_metadata", "0",
"-metadata", fmt.Sprintf("sort_artist=%s", t.escapeMetadata(sortArtist)),
"-metadata", "sort_artist="+t.escapeMetadata(sortArtist),
"-write_id3v2", "1",
"-id3v2_version", "3",
destinationPath,
@@ -165,7 +165,9 @@ func (t *Transcoder) Convert(sourcePath, destinationPath string) (int64, error)
).Debug("FFMpeg parameters")
ffmpeg := exec.Command("ffmpeg", ffmpegArgs...)
var stderr bytes.Buffer
ffmpeg.Stderr = &stderr
if err := ffmpeg.Run(); err != nil {