Fix non-pathological package shadowing

This is smelly more than anything but I should not have missed it
previously.
This commit is contained in:
kortschak 2014-06-28 02:23:02 +09:30
parent 639559544d
commit cf2f5219b2

View file

@ -84,13 +84,13 @@ func (api *Api) ApiV1(r *httprouter.Router) {
r.POST("/api/v1/delete", LogRequest(api.ServeV1Delete)) r.POST("/api/v1/delete", LogRequest(api.ServeV1Delete))
} }
func SetupRoutes(ts graph.TripleStore, config *config.CayleyConfig) { func SetupRoutes(ts graph.TripleStore, cfg *config.CayleyConfig) {
r := httprouter.New() r := httprouter.New()
var templates = template.Must(template.ParseGlob("templates/*.tmpl")) var templates = template.Must(template.ParseGlob("templates/*.tmpl"))
templates.ParseGlob("templates/*.html") templates.ParseGlob("templates/*.html")
root := &TemplateRequestHandler{templates: templates} root := &TemplateRequestHandler{templates: templates}
docs := &DocRequestHandler{} docs := &DocRequestHandler{}
api := &Api{config: config, ts: ts} api := &Api{config: cfg, ts: ts}
api.ApiV1(r) api.ApiV1(r)
//m.Use(martini.Static("static", martini.StaticOptions{Prefix: "/static", SkipLogging: true})) //m.Use(martini.Static("static", martini.StaticOptions{Prefix: "/static", SkipLogging: true}))
@ -102,11 +102,11 @@ func SetupRoutes(ts graph.TripleStore, config *config.CayleyConfig) {
http.Handle("/", r) http.Handle("/", r)
} }
func CayleyHTTP(ts graph.TripleStore, config *config.CayleyConfig) { func CayleyHTTP(ts graph.TripleStore, cfg *config.CayleyConfig) {
SetupRoutes(ts, config) SetupRoutes(ts, cfg)
glog.Infof("Cayley now listening on %s:%s\n", config.ListenHost, config.ListenPort) glog.Infof("Cayley now listening on %s:%s\n", cfg.ListenHost, cfg.ListenPort)
fmt.Printf("Cayley now listening on %s:%s\n", config.ListenHost, config.ListenPort) fmt.Printf("Cayley now listening on %s:%s\n", cfg.ListenHost, cfg.ListenPort)
err := http.ListenAndServe(fmt.Sprintf("%s:%s", config.ListenHost, config.ListenPort), nil) err := http.ListenAndServe(fmt.Sprintf("%s:%s", cfg.ListenHost, cfg.ListenPort), nil)
if err != nil { if err != nil {
glog.Fatal("ListenAndServe: ", err) glog.Fatal("ListenAndServe: ", err)
} }