chore: go fixes

This commit is contained in:
2026-05-02 18:58:13 +02:00
parent b7fee9d063
commit f0b5a4f9a8
8 changed files with 19 additions and 41 deletions

View File

@@ -304,13 +304,6 @@ func getMapKeys(m map[string]any) []string {
return keys
}
func min(a, b int) int {
if a < b {
return a
}
return b
}
func (c *allAnimeClient) extractSourceURLsFromData(ctx context.Context, data map[string]any) []StreamSource {
episodeData, ok := data["episode"].(map[string]any)
if !ok {

View File

@@ -6,6 +6,7 @@ import (
"fmt"
"io"
"log"
"maps"
"net/http"
"sort"
"strconv"
@@ -214,9 +215,7 @@ func (h *Handler) HandleProxy(w http.ResponseWriter, r *http.Request) {
return
}
for k, v := range headers {
w.Header()[k] = v
}
maps.Copy(w.Header(), headers)
w.WriteHeader(statusCode)
if bodyReader != nil {

View File

@@ -31,7 +31,7 @@ func (e *providerExtractor) ExtractVideoLinks(ctx context.Context, providerPath
var resp *http.Response
var err error
for attempt := 0; attempt < 3; attempt++ {
for attempt := range 3 {
if attempt > 0 {
select {
case <-ctx.Done():

View File

@@ -48,12 +48,10 @@ func (s *Service) searchShowResultsByMode(ctx context.Context, query string, mod
var wg sync.WaitGroup
for _, mode := range modeCandidates {
modeValue := mode
wg.Add(1)
go func() {
defer wg.Done()
wg.Go(func() {
results, err := s.allAnimeClient.Search(ctx, query, modeValue)
searchCh <- searchModeResult{Mode: modeValue, Results: results, Err: err}
}()
})
}
wg.Wait()