Skip to content

Commit

Permalink
refactor: refactor codebase for improved compatibility and efficiency
Browse files Browse the repository at this point in the history
- 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>
  • Loading branch information
appleboy committed Oct 4, 2024
1 parent d9f9a4d commit b370179
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions jenkins.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"net/url"
"strings"
Expand Down Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit b370179

Please sign in to comment.