refactor: refactor codebase for improved compatibility and efficiency

- Replace `ioutil.ReadAll` with `io.ReadAll` in `jenkins.go`
- Ignore the return value of `godotenv.Load` in `main.go`
- Ignore the return value of `godotenv.Overload` in `main.go`

Signed-off-by: appleboy <appleboy.tw@gmail.com>
This commit is contained in:
appleboy
2024-10-04 15:34:57 +08:00
parent d9f9a4ddc5
commit b370179bda
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -3,7 +3,7 @@ package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"net/url"
"strings"
@@ -58,7 +58,7 @@ func (jenkins *Jenkins) parseResponse(resp *http.Response, body interface{}) (er
return
}
data, err := ioutil.ReadAll(resp.Body)
data, err := io.ReadAll(resp.Body)
if err != nil {
return
}
+2 -2
View File
@@ -14,11 +14,11 @@ var Version string
func main() {
// Load env-file if it exists first
if filename, found := os.LookupEnv("PLUGIN_ENV_FILE"); found {
godotenv.Load(filename)
_ = godotenv.Load(filename)
}
if _, err := os.Stat("/run/drone/env"); err == nil {
godotenv.Overload("/run/drone/env")
_ = godotenv.Overload("/run/drone/env")
}
app := cli.NewApp()