/usr/share/gocode/src/github.com/bmizerany/pat/example/patexample/hello_appengine.go is in golang-github-bmizerany-pat-dev 0.0~git20140625-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | // hello.go ported for appengine
//
// this differs from the standard hello.go example in two ways: appengine
// already provides an http server for you, obviating the need for the
// ListenAndServe call (with associated logging), and the package must not be
// called main (appengine reserves package 'main' for the underlying program).
package patexample
import (
"io"
"net/http"
"github.com/bmizerany/pat"
)
// hello world, the web server
func HelloServer(w http.ResponseWriter, req *http.Request) {
io.WriteString(w, "hello, "+req.URL.Query().Get(":name")+"!\n")
}
func init() {
m := pat.New()
m.Get("/hello/:name", http.HandlerFunc(HelloServer))
// Register this pat with the default serve mux so that other packages
// may also be exported. (i.e. /debug/pprof/*)
http.Handle("/", m)
}
|