Chore: explore possibilities of using makefile (#17039)

* Chore: explore possibilities of using makefile

This is an exploratory commit - I wanted to see how
revive/gosec linters could be integrated with makefile and our build scripts.

Looks better then I expected :)

* Chore: make revive happy

Revive execution was not supplied with path, if you restore there is couple
errors that were popping up - so I fixed them

* Chore: make revive happy
This commit is contained in:
Oleg Gaidarenko
2019-05-16 00:29:26 +03:00
committed by GitHub
parent 8483a8366f
commit be66ed9dab
13 changed files with 119 additions and 37 deletions
+6 -6
View File
@@ -18,10 +18,10 @@ import (
)
var (
IoHelper m.IoUtil = IoUtilImp{}
HttpClient http.Client
grafanaVersion string
NotFoundError = errors.New("404 not found error")
IoHelper m.IoUtil = IoUtilImp{}
HttpClient http.Client
grafanaVersion string
ErrNotFoundError = errors.New("404 not found error")
)
func Init(version string, skipTLSVerify bool) {
@@ -131,7 +131,7 @@ func GetPlugin(pluginId, repoUrl string) (m.Plugin, error) {
if err != nil {
logger.Info("Failed to send request: ", err)
if err == NotFoundError {
if err == ErrNotFoundError {
return m.Plugin{}, fmt.Errorf("Failed to find requested plugin, check if the plugin_id is correct. error: %v", err)
}
return m.Plugin{}, fmt.Errorf("Failed to send request. error: %v", err)
@@ -174,7 +174,7 @@ func sendRequest(repoUrl string, subPaths ...string) ([]byte, error) {
}
if res.StatusCode == 404 {
return []byte{}, NotFoundError
return []byte{}, ErrNotFoundError
}
if res.StatusCode/100 != 2 {
return []byte{}, fmt.Errorf("Api returned invalid status: %s", res.Status)