diff --git a/db/store.go b/db/store.go index edd64ffe3..f27874682 100644 --- a/db/store.go +++ b/db/store.go @@ -5,7 +5,7 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" + "io" "net/http" "strconv" "time" @@ -175,7 +175,7 @@ func Verify(w http.ResponseWriter, r *http.Request) { } payload := VerifyPayload{} - body, err := ioutil.ReadAll(r.Body) + body, err := io.ReadAll(r.Body) r.Body.Close() err = json.Unmarshal(body, &payload) if err != nil { @@ -263,7 +263,7 @@ type Save struct { func PostSave(w http.ResponseWriter, r *http.Request) { save := Save{} - body, err := ioutil.ReadAll(r.Body) + body, err := io.ReadAll(r.Body) r.Body.Close() err = json.Unmarshal(body, &save) if err != nil { diff --git a/feeds/generic.go b/feeds/generic.go index 30df499d3..7bab0caa5 100644 --- a/feeds/generic.go +++ b/feeds/generic.go @@ -2,7 +2,7 @@ package feeds import ( "encoding/json" - "io/ioutil" + "io" "net/http" "strings" ) @@ -161,6 +161,6 @@ func httpget(url string) ([]byte, error) { } defer response.Body.Close() - body, _ := ioutil.ReadAll(response.Body) + body, _ := io.ReadAll(response.Body) return body, nil } diff --git a/feeds/podcastindex.go b/feeds/podcastindex.go index de9f6d552..0f0eedcc5 100644 --- a/feeds/podcastindex.go +++ b/feeds/podcastindex.go @@ -5,7 +5,7 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" + "io" "net/http" "os" "strconv" @@ -122,7 +122,7 @@ func PodcastFeed(url string, fulltext bool) (*Podcast, error) { defer resp.Body.Close() var r PodcastResponse - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) err = json.Unmarshal(body, &r) if err != nil { fmt.Println("=> json unmarshall error", err) @@ -158,7 +158,7 @@ func PodcastEpisodes(url string, fulltext bool) ([]Episode, error) { defer resp.Body.Close() var r EpisodeResponse - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) err = json.Unmarshal(body, &r) if err != nil { fmt.Println("json unmarshall error", err) @@ -234,7 +234,7 @@ func PodcastEpisodesByPerson(query string, fulltext bool) ([]Episode, error) { defer resp.Body.Close() var r EpisodeResponse - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) err = json.Unmarshal(body, &r) if err != nil { fmt.Println("json unmarshall error", err) diff --git a/handlers/bots.go b/handlers/bots.go index 935ff29ab..e1700bbfc 100644 --- a/handlers/bots.go +++ b/handlers/bots.go @@ -3,7 +3,7 @@ package handlers import ( "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "regexp" "strconv" @@ -20,7 +20,7 @@ func CreateOrEditBot(w http.ResponseWriter, r *http.Request) { pubKeyFromAuth, _ := ctx.Value(auth.ContextKey).(string) bot := db.Bot{} - body, err := ioutil.ReadAll(r.Body) + body, err := io.ReadAll(r.Body) r.Body.Close() err = json.Unmarshal(body, &bot) if err != nil { diff --git a/handlers/bounties.go b/handlers/bounties.go index f2efb4e70..6177442ab 100644 --- a/handlers/bounties.go +++ b/handlers/bounties.go @@ -3,7 +3,7 @@ package handlers import ( "encoding/json" "fmt" - "io/ioutil" + "io" "log" "net/http" "reflect" @@ -46,7 +46,7 @@ func GetBountiesLeaderboard(w http.ResponseWriter, _ *http.Request) { func DeleteBountyAssignee(w http.ResponseWriter, r *http.Request) { invoice := db.DeleteBountyAssignee{} - body, err := ioutil.ReadAll(r.Body) + body, err := io.ReadAll(r.Body) var deletedAssignee bool r.Body.Close() diff --git a/handlers/channel.go b/handlers/channel.go index fa9ca5f77..627fe1e97 100644 --- a/handlers/channel.go +++ b/handlers/channel.go @@ -3,7 +3,7 @@ package handlers import ( "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "strconv" @@ -56,7 +56,7 @@ func CreateChannel(w http.ResponseWriter, r *http.Request) { pubKeyFromAuth, _ := ctx.Value(auth.ContextKey).(string) channel := db.Channel{} - body, err := ioutil.ReadAll(r.Body) + body, err := io.ReadAll(r.Body) r.Body.Close() err = json.Unmarshal(body, &channel) if err != nil { diff --git a/handlers/feed.go b/handlers/feed.go index f1eaae3d8..9507c2e38 100644 --- a/handlers/feed.go +++ b/handlers/feed.go @@ -6,7 +6,7 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" + "io" "net/http" "os" "strings" @@ -53,7 +53,7 @@ func DownloadYoutubeFeed(w http.ResponseWriter, r *http.Request) { tube, err := youtube.NewService(ctx, option.WithAPIKey(apiKey)) youtube_download := db.YoutubeDownload{} - body, err := ioutil.ReadAll(r.Body) + body, err := io.ReadAll(r.Body) r.Body.Close() err = json.Unmarshal(body, &youtube_download) @@ -143,7 +143,7 @@ func processYoutubeDownload(data []string) { fmt.Println("Youtube Download Request Error ===", err) } defer response.Body.Close() - res, err := ioutil.ReadAll(response.Body) + res, err := io.ReadAll(response.Body) if err != nil { fmt.Println("Youtube Download Request Error ==", err) } @@ -272,7 +272,7 @@ func getFeed(feedURL string, feedID string) (*feeds.Podcast, error) { defer resp.Body.Close() var r feeds.PodcastResponse - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) err = json.Unmarshal(body, &r) if err != nil { fmt.Println("json unmarshall error", err) @@ -314,7 +314,7 @@ func getEpisodes(feedURL string, feedID string) ([]feeds.Episode, error) { defer resp.Body.Close() var r feeds.EpisodeResponse - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) err = json.Unmarshal(body, &r) if err != nil { fmt.Println("json unmarshall error", err) @@ -348,7 +348,7 @@ func searchPodcastIndex(term string) ([]feeds.Podcast, error) { defer resp.Body.Close() var r feeds.PodcastSearchResponse - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) err = json.Unmarshal(body, &r) if err != nil { fmt.Println("json unmarshall error", err) diff --git a/handlers/people.go b/handlers/people.go index f0b0df1d6..1bac21c1a 100644 --- a/handlers/people.go +++ b/handlers/people.go @@ -5,7 +5,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "log" "net/http" "os" @@ -479,7 +478,7 @@ func GetAssetByPubkey(pubkey string) ([]db.AssetBalanceData, error) { defer resp.Body.Close() var r db.AssetResponse - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) err = json.Unmarshal(body, &r) if err != nil { fmt.Println("json unmarshall error", err) @@ -512,7 +511,7 @@ func GetAssetList(pubkey string) ([]db.AssetListData, error) { defer resp.Body.Close() var r []db.AssetListData - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) err = json.Unmarshal(body, &r) if err != nil { fmt.Println("json unmarshall error", err) @@ -527,7 +526,7 @@ func AddOrRemoveBadge(w http.ResponseWriter, r *http.Request) { pubKeyFromAuth, _ := ctx.Value(auth.ContextKey).(string) badgeCreationData := db.BadgeCreationData{} - body, err := ioutil.ReadAll(r.Body) + body, err := io.ReadAll(r.Body) r.Body.Close() err = json.Unmarshal(body, &badgeCreationData) if err != nil { diff --git a/routes/index.go b/routes/index.go index ba2cf7233..d489f4923 100644 --- a/routes/index.go +++ b/routes/index.go @@ -3,7 +3,7 @@ package routes import ( "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "os" "time" @@ -116,7 +116,7 @@ func getFromAuth(path string) (*extractResponse, error) { return nil, err } defer resp.Body.Close() - body2, err := ioutil.ReadAll(resp.Body) + body2, err := io.ReadAll(resp.Body) if err != nil { return nil, err }