func perform_hook(w http.ResponseWriter, req *http.Request, l work_loader) { body := strings.NewReader(req.FormValue("payload")) if err := l.Load(body); err != nil { log.Println("error loading hook message:", err) perform_status(w, nil, http.StatusInternalServerError) return } worker.Schedule(l) }
func handle_go_get(w http.ResponseWriter, req *http.Request) { imp := req.FormValue(":import") if imp == "" { log.Println("handle_go_get: package name empty") perform_status(w, nil, http.StatusNotFound) return } worker.Schedule(Package{ Import: imp, }) }
func perform_google_hook(w http.ResponseWriter, req *http.Request, m *google.HookMessage) { if err := m.Load(req.Body); err != nil { log.Println("error loading hook message:", err) perform_status(w, nil, http.StatusInternalServerError) return } switch req.FormValue(":vcs") { case "git": m.Vcs = builder.Git case "hg": m.Vcs = builder.HG default: perform_status(w, nil, http.StatusOK) return } worker.Schedule(m) }
//our basic handle index that demonstrates how to get data from the context //inside a template func handle_simple_work(w http.ResponseWriter, req *http.Request, ctx *Context) { worker.Schedule(test_work) log.Println("sent item in") }