Revert "godoc/dl: provide JSON feed of releases"

This reverts commit 07fd8470d6.

Reason for revert: doesn't compile; was never tested apparently.

Change-Id: I9502dbd3fae1f388ee48d6de9a3f2c1df53411ad
Reviewed-on: https://go-review.googlesource.com/96235
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Brad Fitzpatrick 2018-02-22 03:57:59 +00:00
parent 733d489786
commit f8f2f88271
1 changed files with 14 additions and 26 deletions

View File

@ -48,15 +48,15 @@ func RegisterHandlers(mux *http.ServeMux) {
} }
type File struct { type File struct {
Filename string `json:"filename"` Filename string
OS string `json:"os"` OS string
Arch string `json:"arch"` Arch string
Version string `json:"-"` Version string
Checksum string `json:"-" datastore:",noindex"` // SHA1; deprecated Checksum string `datastore:",noindex"` // SHA1; deprecated
ChecksumSHA256 string `json:"sha256" datastore:",noindex"` ChecksumSHA256 string `datastore:",noindex"`
Size int64 `json:"size" datastore:",noindex"` Size int64 `datastore:",noindex"`
Kind string `json:"kind"` // "archive", "installer", "source" Kind string // "archive", "installer", "source"
Uploaded time.Time `json:"-"` Uploaded time.Time
} }
func (f File) ChecksumType() string { func (f File) ChecksumType() string {
@ -137,11 +137,11 @@ func (f File) URL() string {
} }
type Release struct { type Release struct {
Version string `json:"version"` Version string
Stable bool `json:"stable"` Stable bool
Files []File `json:"files"` Files []File
Visible bool `json:"-"` // show files on page load Visible bool // show files on page load
SplitPortTable bool `json:"-"` // whether files should be split by primary/other ports. SplitPortTable bool // whether files should be split by primary/other ports.
} }
type Feature struct { type Feature struct {
@ -221,18 +221,6 @@ func listHandler(w http.ResponseWriter, r *http.Request) {
log.Errorf(c, "cache set error: %v", err) log.Errorf(c, "cache set error: %v", err)
} }
} }
if r.URL.Query().Get("mode") == "json" {
w.Header.Set("Content-Type", "application/json")
e := json.NewEncoder(w).SetIndent("", " ")
if err := e.Encode(d.Stable); err != nil {
log.Errorf(c, "failed rendering JSON for releases: %v", err)
}
return
}
if err := listTemplate.ExecuteTemplate(w, "root", d); err != nil { if err := listTemplate.ExecuteTemplate(w, "root", d); err != nil {
log.Errorf(c, "error executing template: %v", err) log.Errorf(c, "error executing template: %v", err)
} }