1
0
mirror of https://github.com/golang/go synced 2024-11-19 08:44:39 -07:00
go/dashboard/app/build/init.go
Chris Manghane 7bcc81e644 go.tools/dashboard: add gccgo build dashboard.
This change adds a new build dashboard url to the existing appengine app: $dashurl/gccgo/ which will show the build status of gccgo.
* Added Dashboard struct with exported Name, Rel(ative)Path, and Packages fields.
* Added Dashboard Context method that returns an appengine context with a namespace corresponding to the dashboard's name.
* Modified HandlerFuncs to use Dashboard's Context method for all appengine requests.
* Modified ui template to show different title/header for separate dashboard and added dashboard tab.

R=adg
CC=golang-dev
https://golang.org/cl/13753043
2013-09-23 17:06:49 -07:00

41 lines
880 B
Go

// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build appengine
package build
import (
"fmt"
"net/http"
"appengine"
"appengine/datastore"
"cache"
)
func initHandler(w http.ResponseWriter, r *http.Request) {
d := dashboardForRequest(r)
c := d.Context(appengine.NewContext(r))
defer cache.Tick(c)
for _, p := range d.Packages {
err := datastore.Get(c, p.Key(c), new(Package))
if _, ok := err.(*datastore.ErrFieldMismatch); ok {
// Some fields have been removed, so it's okay to ignore this error.
err = nil
}
if err == nil {
continue
} else if err != datastore.ErrNoSuchEntity {
logErr(w, r, err)
return
}
if _, err := datastore.Put(c, p.Key(c), p); err != nil {
logErr(w, r, err)
return
}
}
fmt.Fprint(w, "OK")
}