From 4550b4d8611a4c5d1e256447434fb1ff3b2b26ce Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Wed, 6 Jul 2016 22:54:21 +0200 Subject: [PATCH] fix loading list instead of latest release --- service_github.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/service_github.go b/service_github.go index 69de85c..383b2ea 100644 --- a/service_github.go +++ b/service_github.go @@ -59,12 +59,12 @@ func (g githubServiceHandler) Handle(ctx context.Context, params []string) (titl } func (g githubServiceHandler) handleLatestRelease(ctx context.Context, params []string) (title, text, color string, err error) { - path := strings.Join([]string{"repos", params[0], params[1], "releases"}, "/") + path := strings.Join([]string{"repos", params[0], params[1], "releases", "latest"}, "/") text, err = cacheStore.Get("github_latest_release", path) if err != nil { - r := []struct { + r := struct { TagName string `json:"tag_name"` }{} @@ -72,9 +72,8 @@ func (g githubServiceHandler) handleLatestRelease(ctx context.Context, params [] return } - if len(r) > 0 { - text = r[0].TagName - } else { + text = r.TagName + if text == "" { text = "None" } cacheStore.Set("github_latest_release", path, text, 10*time.Minute)