mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 07:26:45 +00:00
fix: dont use ioutils and handle error
This commit is contained in:
@@ -4,7 +4,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
@@ -55,7 +55,7 @@ func getLatestTag(repoOwner string, repoName string) (string, error) {
|
|||||||
|
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
body, err := ioutil.ReadAll(resp.Body)
|
body, err := io.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
@@ -64,7 +64,9 @@ func getLatestTag(repoOwner string, repoName string) (string, error) {
|
|||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
}
|
}
|
||||||
|
|
||||||
json.Unmarshal(body, &tags)
|
if err := json.Unmarshal(body, &tags); err != nil {
|
||||||
|
return "", fmt.Errorf("failed to unmarshal github response: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
return tags[0].Name[1:], nil
|
return tags[0].Name[1:], nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user