From f45a5cab605ef4bb1e157e4e27abd73c57bfa088 Mon Sep 17 00:00:00 2001 From: Fabian Reinartz Date: Thu, 28 May 2015 21:22:08 +0200 Subject: [PATCH] Move templates package to pkg/template --- rules/manager.go | 6 +++--- templates/templates.go => template/template.go | 2 +- templates/templates_test.go => template/template_test.go | 2 +- web/consoles.go | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) rename templates/templates.go => template/template.go (99%) rename templates/templates_test.go => template/template_test.go (99%) diff --git a/rules/manager.go b/rules/manager.go index a901991f0..e52f72e32 100644 --- a/rules/manager.go +++ b/rules/manager.go @@ -30,7 +30,7 @@ import ( "github.com/prometheus/prometheus/notification" "github.com/prometheus/prometheus/promql" "github.com/prometheus/prometheus/storage" - "github.com/prometheus/prometheus/templates" + "github.com/prometheus/prometheus/template" "github.com/prometheus/prometheus/utility" ) @@ -195,8 +195,8 @@ func (m *Manager) queueAlertNotifications(rule *AlertingRule, timestamp clientmo defs := "{{$labels := .Labels}}{{$value := .Value}}" expand := func(text string) string { - template := templates.NewTemplateExpander(defs+text, "__alert_"+rule.Name(), tmplData, timestamp, m.queryEngine, m.pathPrefix) - result, err := template.Expand() + tmpl := template.NewTemplateExpander(defs+text, "__alert_"+rule.Name(), tmplData, timestamp, m.queryEngine, m.pathPrefix) + result, err := tmpl.Expand() if err != nil { result = err.Error() log.Warnf("Error expanding alert template %v with data '%v': %v", rule.Name(), tmplData, err) diff --git a/templates/templates.go b/template/template.go similarity index 99% rename from templates/templates.go rename to template/template.go index e7992db56..cb158d609 100644 --- a/templates/templates.go +++ b/template/template.go @@ -11,7 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package templates +package template import ( "bytes" diff --git a/templates/templates_test.go b/template/template_test.go similarity index 99% rename from templates/templates_test.go rename to template/template_test.go index 10799065c..7c3c47311 100644 --- a/templates/templates_test.go +++ b/template/template_test.go @@ -11,7 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package templates +package template import ( "math" diff --git a/web/consoles.go b/web/consoles.go index 9c2da52cf..27e70e05f 100644 --- a/web/consoles.go +++ b/web/consoles.go @@ -23,7 +23,7 @@ import ( clientmodel "github.com/prometheus/client_golang/model" "github.com/prometheus/prometheus/promql" - "github.com/prometheus/prometheus/templates" + "github.com/prometheus/prometheus/template" ) var ( @@ -70,13 +70,13 @@ func (h *ConsolesHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { Path: r.URL.Path, } - template := templates.NewTemplateExpander(string(text), "__console_"+r.URL.Path, data, clientmodel.Now(), h.QueryEngine, h.PathPrefix) + tmpl := template.NewTemplateExpander(string(text), "__console_"+r.URL.Path, data, clientmodel.Now(), h.QueryEngine, h.PathPrefix) filenames, err := filepath.Glob(*consoleLibrariesPath + "/*.lib") if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } - result, err := template.ExpandHTML(filenames) + result, err := tmpl.ExpandHTML(filenames) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return