Selaa lähdekoodia

Rename starInfo to repoInfo

Because that's the correct name.  `/users/:username/repos` has the same
format as `/users/:username/starred`.  (Or rather, the other way
around.)
Lucas Stadler 10 vuotta sitten
vanhempi
commit
c7594b11db
1 muutettua tiedostoa jossa 6 lisäystä ja 6 poistoa
  1. 6 6
      go/stars/stars.go

+ 6 - 6
go/stars/stars.go

@ -28,7 +28,7 @@ func init() {
28 28
func main() {
29 29
	flag.Parse()
30 30
31
	var stars []starInfo
31
	var stars []repoInfo
32 32
	decoder := json.NewDecoder(os.Stdin)
33 33
	err := decoder.Decode(&stars)
34 34
	if err != nil {
@ -59,7 +59,7 @@ func main() {
59 59
	wg.Wait()
60 60
}
61 61
62
func updateRepo(info starInfo) error {
62
func updateRepo(info repoInfo) error {
63 63
	f, err := os.Open(path.Join(config.directory, info.RepoName))
64 64
	if err != nil {
65 65
		if os.IsNotExist(err) {
@ -82,18 +82,18 @@ func updateRepo(info starInfo) error {
82 82
	return nil
83 83
}
84 84
85
func gitClone(info starInfo) error {
85
func gitClone(info repoInfo) error {
86 86
	cmd := exec.Command("git", "clone", info.CloneUrl,
87 87
		path.Join(config.directory, info.RepoName))
88 88
	return cmd.Run()
89 89
}
90 90
91
func gitPull(info starInfo) error {
91
func gitPull(info repoInfo) error {
92 92
	cmd := exec.Command("git", "-C", path.Join(config.directory, info.RepoName), "pull")
93 93
	return cmd.Run()
94 94
}
95 95
96
func gitLastCommit(info starInfo) (time.Time, error) {
96
func gitLastCommit(info repoInfo) (time.Time, error) {
97 97
	cmd := exec.Command("git", "-C", path.Join(config.directory, info.RepoName),
98 98
		"log", "-n", "1", "--format=%cd", "--date=iso8601-strict")
99 99
	out, err := cmd.Output()
@ -105,7 +105,7 @@ func gitLastCommit(info starInfo) (time.Time, error) {
105 105
	return time.Parse(time.RFC3339, outStr)
106 106
}
107 107
108
type starInfo struct {
108
type repoInfo struct {
109 109
	RepoName    string    `json:"full_name"`
110 110
	Description string    `json:"description"`
111 111
	CloneUrl    string    `json:"git_url"`