From cf2f5219b293ae65dea617824186fab8eeb12a95 Mon Sep 17 00:00:00 2001 From: kortschak Date: Sat, 28 Jun 2014 02:23:02 +0930 Subject: [PATCH] Fix non-pathological package shadowing This is smelly more than anything but I should not have missed it previously. --- http/cayley_http.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/http/cayley_http.go b/http/cayley_http.go index 515d175..f4ad6fa 100644 --- a/http/cayley_http.go +++ b/http/cayley_http.go @@ -84,13 +84,13 @@ func (api *Api) ApiV1(r *httprouter.Router) { 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() var templates = template.Must(template.ParseGlob("templates/*.tmpl")) templates.ParseGlob("templates/*.html") root := &TemplateRequestHandler{templates: templates} docs := &DocRequestHandler{} - api := &Api{config: config, ts: ts} + api := &Api{config: cfg, ts: ts} api.ApiV1(r) //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) } -func CayleyHTTP(ts graph.TripleStore, config *config.CayleyConfig) { - SetupRoutes(ts, config) - glog.Infof("Cayley now listening on %s:%s\n", config.ListenHost, config.ListenPort) - fmt.Printf("Cayley now listening on %s:%s\n", config.ListenHost, config.ListenPort) - err := http.ListenAndServe(fmt.Sprintf("%s:%s", config.ListenHost, config.ListenPort), nil) +func CayleyHTTP(ts graph.TripleStore, cfg *config.CayleyConfig) { + SetupRoutes(ts, cfg) + glog.Infof("Cayley now listening on %s:%s\n", cfg.ListenHost, cfg.ListenPort) + fmt.Printf("Cayley now listening on %s:%s\n", cfg.ListenHost, cfg.ListenPort) + err := http.ListenAndServe(fmt.Sprintf("%s:%s", cfg.ListenHost, cfg.ListenPort), nil) if err != nil { glog.Fatal("ListenAndServe: ", err) }