Modified harness to bootstrap using the go engine. Skeleton app updated to use new request code

This commit is contained in:
NotZippy
2017-05-04 16:29:21 -07:00
parent 7eda33eb71
commit efcd02de37
4 changed files with 27 additions and 9 deletions

View File

@@ -47,10 +47,12 @@ type Harness struct {
proxy *httputil.ReverseProxy
}
func renderError(w http.ResponseWriter, r *http.Request, err error) {
req, resp := revel.NewRequest(r), revel.NewResponse(w)
c := revel.NewController(req, resp)
c.RenderError(err).Apply(req, resp)
func renderError(iw http.ResponseWriter, ir *http.Request, err error) {
context := revel.NewGOContext(nil)
context.Request.SetRequest(ir)
context.Response.SetResponse(iw)
c := revel.NewController(context)
c.RenderError(err).Apply(c.Request, c.Response)
}
// ServeHTTP handles all requests.

View File

@@ -160,8 +160,20 @@ func ProcessSource(roots []string) (*SourceInfo, *revel.Error) {
return nil
}
// Ignore packages that end with _test
for i := range pkgs {
if len(i) > 6 {
if string(i[len(i)-5:]) == "_test" {
delete(pkgs, i)
}
}
}
// There should be only one package in this directory.
if len(pkgs) > 1 {
for i := range pkgs {
println("Found package ", i)
}
log.Println("Most unexpected! Multiple packages in a single directory:", pkgs)
}