Skip to content

Commit

Permalink
Merge pull request #389 from paskal/fix_golangcilint_errors
Browse files Browse the repository at this point in the history
[rss-generator] Fix golangci-lint reported errors, handle one unhandled error
umputun authored Oct 13, 2024
2 parents d11bcd9 + 9c535ff commit 648b514
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 3 additions & 0 deletions rss_generator/proc/generator.go
Original file line number Diff line number Diff line change
@@ -209,6 +209,9 @@ func (g *RSSGenerator) getMp3Size(mp3File string) (int, error) {

// if no Content-Length header from HEAD request, try GET request
req, err = http.NewRequest("GET", url, http.NoBody)
if err != nil {
return 0, fmt.Errorf("error creating request: %v", err)
}
resp, err = g.Client.Do(req)
if err != nil {
return 0, fmt.Errorf("error getting response for %s: %v", req.URL, err)
3 changes: 1 addition & 2 deletions rss_generator/proc/generator_test.go
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@ func TestRSSGenerator_getMp3Size(t *testing.T) {
return
}
if r.URL.Path == "/other-file.mp3" && r.Method == "GET" {
w.Write([]byte("Hello world"))
_, _ = w.Write([]byte("Hello world"))
return
}
w.WriteHeader(http.StatusNotFound)
@@ -83,7 +83,6 @@ func TestRSSGenerator_getMp3Size(t *testing.T) {
func TestRSSGenerator_createItemData(t *testing.T) {
testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Length", "1234")
return
}))
defer testServer.Close()

0 comments on commit 648b514

Please sign in to comment.