Update documentation

Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
This commit is contained in:
Tom Chauveau
2021-05-06 19:20:56 +02:00
parent 5f723df36a
commit 0e320eca70
3 changed files with 86 additions and 3 deletions

View File

@@ -46,7 +46,7 @@ var versionCmd = &cobra.Command{
runtime.GOOS, runtime.GOARCH,
)
if check := viper.GetBool("check"); check != false {
if check := viper.GetBool("check"); check {
upToDate, err := isVersionLatest()
if err != nil {
fmt.Println("error: could not check version.")
@@ -110,10 +110,12 @@ func getOnlineVersion(currentVersion *goVersion.Version) (*goVersion.Version, er
return nil, err
}
defer resp.Body.Close()
data, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, err
}
latestVersion := strings.TrimSuffix(string(data), "\n")
return goVersion.NewVersion(latestVersion)
}
@@ -164,7 +166,7 @@ func checkVersion() {
// Update check timestamps file
now := time.Now().Format(time.RFC3339)
ioutil.WriteFile(daggerDirectory+"/version_check.txt", []byte(now), 0644)
ioutil.WriteFile(daggerDirectory+"/version_check.txt", []byte(now), 0600)
}
}