Skip to content

Commit

Permalink
Clean up deprecation and some warnings and regenerate fake_plugin_rep…
Browse files Browse the repository at this point in the history
…o as we made changes
  • Loading branch information
moleske committed Jan 4, 2024
1 parent 7ba9e79 commit 8883906
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
13 changes: 9 additions & 4 deletions cf/actors/pluginrepo/plugin_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"code.cloudfoundry.org/cli/version"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"os"
"path/filepath"
Expand All @@ -31,7 +31,7 @@ func NewPluginRepo() PluginRepo {

func (r pluginRepo) GetPlugins(repos []models.PluginRepo) (map[string][]clipr.Plugin, []string) {
var pluginList clipr.PluginsJson
repoError := []string{}
var repoError []string
repoPlugins := make(map[string][]clipr.Plugin)

for _, repo := range repos {
Expand All @@ -54,9 +54,14 @@ func (r pluginRepo) GetPlugins(repos []models.PluginRepo) (map[string][]clipr.Pl
repoError = append(repoError, fmt.Sprintf(T("Error requesting from")+" '%s' - %s", repo.Name, err.Error()))
continue
} else {
defer resp.Body.Close()
defer func(Body io.ReadCloser) {
err := Body.Close()
if err != nil {
repoError = append(repoError, fmt.Sprintf(T("Error closing body")+" '%s' - %s", repo.Name, err.Error()))
}
}(resp.Body)

body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
repoError = append(repoError, fmt.Sprintf(T("Error reading response from")+" '%s' - %s ", repo.Name, err.Error()))
continue
Expand Down
7 changes: 4 additions & 3 deletions cf/actors/pluginrepo/pluginrepofakes/fake_plugin_repo.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8883906

Please sign in to comment.