"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "internal/update/update.go" between
gh-cli-1.10.3.tar.gz and gh-cli-1.11.0.tar.gz

About: GitHub CLI is GitHub’s official command line tool.

update.go  (gh-cli-1.10.3):update.go  (gh-cli-1.11.0)
package update package update
import ( import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"os"
"path/filepath"
"regexp" "regexp"
"strconv" "strconv"
"strings" "strings"
"time" "time"
"github.com/cli/cli/api" "github.com/cli/cli/api"
"github.com/cli/cli/internal/ghinstance" "github.com/cli/cli/internal/ghinstance"
"github.com/hashicorp/go-version" "github.com/hashicorp/go-version"
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
) )
skipping to change at line 86 skipping to change at line 88
return &stateEntry, nil return &stateEntry, nil
} }
func setStateEntry(stateFilePath string, t time.Time, r ReleaseInfo) error { func setStateEntry(stateFilePath string, t time.Time, r ReleaseInfo) error {
data := StateEntry{CheckedForUpdateAt: t, LatestRelease: r} data := StateEntry{CheckedForUpdateAt: t, LatestRelease: r}
content, err := yaml.Marshal(data) content, err := yaml.Marshal(data)
if err != nil { if err != nil {
return err return err
} }
_ = ioutil.WriteFile(stateFilePath, content, 0600)
return nil err = os.MkdirAll(filepath.Dir(stateFilePath), 0755)
if err != nil {
return err
}
err = ioutil.WriteFile(stateFilePath, content, 0600)
return err
} }
func versionGreaterThan(v, w string) bool { func versionGreaterThan(v, w string) bool {
w = gitDescribeSuffixRE.ReplaceAllStringFunc(w, func(m string) string { w = gitDescribeSuffixRE.ReplaceAllStringFunc(w, func(m string) string {
idx := strings.IndexRune(m, '-') idx := strings.IndexRune(m, '-')
n, _ := strconv.Atoi(m[0:idx]) n, _ := strconv.Atoi(m[0:idx])
return fmt.Sprintf("%d-pre.0", n+1) return fmt.Sprintf("%d-pre.0", n+1)
}) })
vv, ve := version.NewVersion(v) vv, ve := version.NewVersion(v)
 End of changes. 3 change blocks. 
2 lines changed or deleted 9 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)