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:
@@ -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)
|
||||
|
||||
@@ -31,12 +31,12 @@ func isDevEnvironment() bool {
|
||||
defaultsPath := filepath.Join(exPath, "../conf/defaults.ini")
|
||||
_, err = os.Stat(defaultsPath)
|
||||
return err == nil
|
||||
} else {
|
||||
// But at the same time there are per platform directories that contain the binaries and can also be used.
|
||||
defaultsPath := filepath.Join(exPath, "../../conf/defaults.ini")
|
||||
_, err = os.Stat(defaultsPath)
|
||||
return err == nil
|
||||
}
|
||||
|
||||
// But at the same time there are per platform directories that contain the binaries and can also be used.
|
||||
defaultsPath := filepath.Join(exPath, "../../conf/defaults.ini")
|
||||
_, err = os.Stat(defaultsPath)
|
||||
return err == nil
|
||||
}
|
||||
|
||||
func returnOsDefault(currentOs string) string {
|
||||
|
||||
Reference in New Issue
Block a user