mirror of
https://github.com/appleboy/drone-jenkins.git
synced 2026-06-04 10:15:02 +08:00
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:
+2
-2
@@ -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
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user