cmd/gopherbot: use releases cache for an hour

The previous condition could never be true (unless the current time
went back by more than an hour), so the cached releases.major value
was never used. An HTTP request to the remote server was made on each
getMajorReleases call.

This change fixes the condition to use the cached releases.major value
within an hour of fetching it.

Updates golang/go#24899

Change-Id: I71da1b2503075db878b371606436130931dbcc0d
Reviewed-on: https://go-review.googlesource.com/c/147437
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/cmd/gopherbot/gopherbot.go b/cmd/gopherbot/gopherbot.go
index d31ce31..1d33167 100644
--- a/cmd/gopherbot/gopherbot.go
+++ b/cmd/gopherbot/gopherbot.go
@@ -1183,7 +1183,7 @@
 func (b *gopherbot) getMajorReleases(ctx context.Context) ([]string, error) {
 	b.releases.Lock()
 	defer b.releases.Unlock()
-	if b.releases.lastUpdate.After(time.Now().Add(time.Hour)) {
+	if expiry := b.releases.lastUpdate.Add(time.Hour); time.Now().Before(expiry) {
 		return b.releases.major, nil
 	}
 	ctx, cancel := context.WithTimeout(ctx, 10*time.Second)