From b370179bdad3c085f38172ea056cb4bd11ba5979 Mon Sep 17 00:00:00 2001 From: appleboy Date: Fri, 4 Oct 2024 15:34:57 +0800 Subject: [PATCH] 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 --- jenkins.go | 4 ++-- main.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jenkins.go b/jenkins.go index f5cf660..cd42bc4 100644 --- a/jenkins.go +++ b/jenkins.go @@ -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 } diff --git a/main.go b/main.go index 00fb7c5..152b207 100644 --- a/main.go +++ b/main.go @@ -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()