Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: zachaller <[email protected]>
  • Loading branch information
zachaller committed Jan 17, 2023
1 parent e4ec998 commit ec45912
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions utils/plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ import (
log "github.com/sirupsen/logrus"
)

type FileDownloader interface {
Get(url string) (resp *http.Response, err error)
}

type FileDownloaderImpl struct {
FileDownloader
}

func (fd FileDownloaderImpl) Get(url string) (resp *http.Response, err error) {
return http.Get(url)
}

// CheckPluginExists this function checks if the plugin exists in the configured path if not we panic
func checkPluginExists() error {
if defaults.GetMetricPluginLocation() != "" {
Expand All @@ -37,18 +49,6 @@ func checkShaOfPlugin(pluginLocation string, expectedSha256 string) (bool, error
return fileSha256 == expectedSha256, nil
}

type FileDownloader interface {
Get(url string) (resp *http.Response, err error)
}

type FileDownloaderImpl struct {
FileDownloader
}

func (fd FileDownloaderImpl) Get(url string) (resp *http.Response, err error) {
return http.Get(url)
}

func downloadFile(filepath string, url string, downloader FileDownloader) error {
// Get the data
resp, err := downloader.Get(url)
Expand Down

0 comments on commit ec45912

Please sign in to comment.