From d89c01b0658465523cca1986a584e2598488e315 Mon Sep 17 00:00:00 2001 From: Simon Pasquier Date: Mon, 12 Nov 2018 10:56:21 +0100 Subject: [PATCH] web/ui: fix asset generation for Go modules installs Signed-off-by: Simon Pasquier --- web/ui/ui.go | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/web/ui/ui.go b/web/ui/ui.go index bc61605df..04764e3bf 100644 --- a/web/ui/ui.go +++ b/web/ui/ui.go @@ -16,8 +16,6 @@ package ui import ( - "go/build" - "log" "net/http" "os" "strings" @@ -26,16 +24,8 @@ import ( "github.com/shurcooL/httpfs/union" ) -func importPathToDir(importPath string) string { - p, err := build.Import(importPath, "", build.FindOnly) - if err != nil { - log.Fatalln(err) - } - return p.Dir -} - var static http.FileSystem = filter.Keep( - http.Dir(importPathToDir("github.com/prometheus/prometheus/web/ui/static")), + http.Dir("./static"), func(path string, fi os.FileInfo) bool { return fi.IsDir() || (!strings.HasSuffix(path, "map.js") && @@ -46,7 +36,7 @@ var static http.FileSystem = filter.Keep( ) var templates http.FileSystem = filter.Keep( - http.Dir(importPathToDir("github.com/prometheus/prometheus/web/ui/templates")), + http.Dir("./templates"), func(path string, fi os.FileInfo) bool { return fi.IsDir() || strings.HasSuffix(path, ".html") },