diff --git a/handler.go b/handler.go index e4a707d8f..6e93ae380 100644 --- a/handler.go +++ b/handler.go @@ -42,9 +42,6 @@ import ( "github.com/pilosa/pilosa/pql" "unicode" - - // Allow building Pilosa without the web UI. - _ "github.com/pilosa/pilosa/statik" ) // Handler represents an HTTP handler. @@ -289,13 +286,13 @@ func (h *Handler) handleWebUI(w http.ResponseWriter, r *http.Request) { http.Error(w, "Welcome. Pilosa is running. Visit https://www.pilosa.com/docs/ for more information or try the WebUI by visiting this URL in your browser.", http.StatusNotFound) return } - statikFS, err := h.FileSystem.New() + filesystem, err := h.FileSystem.New() if err != nil { h.writeQueryResponse(w, r, &QueryResponse{Err: err}) h.logger().Println("Pilosa WebUI is not available. Please run `make generate-statik` before building Pilosa with `make install`.") return } - http.FileServer(statikFS).ServeHTTP(w, r) + http.FileServer(filesystem).ServeHTTP(w, r) } // handleGetSchema handles GET /schema requests. diff --git a/handler_test.go b/handler_test.go index 5d8af43a9..aa8ad2970 100644 --- a/handler_test.go +++ b/handler_test.go @@ -31,7 +31,7 @@ import ( "github.com/pilosa/pilosa" "github.com/pilosa/pilosa/internal" "github.com/pilosa/pilosa/pql" - statik "github.com/pilosa/pilosa/statik/filesystem" + "github.com/pilosa/pilosa/statik" "github.com/pilosa/pilosa/test" ) diff --git a/server/server.go b/server/server.go index 67498d7d4..b9140f6a3 100644 --- a/server/server.go +++ b/server/server.go @@ -35,7 +35,7 @@ import ( "github.com/pilosa/pilosa" "github.com/pilosa/pilosa/gcnotify" "github.com/pilosa/pilosa/gossip" - statik "github.com/pilosa/pilosa/statik/filesystem" + "github.com/pilosa/pilosa/statik" "github.com/pilosa/pilosa/statsd" ) diff --git a/statik/doc.go b/statik/doc.go deleted file mode 100644 index 9310eb508..000000000 --- a/statik/doc.go +++ /dev/null @@ -1,4 +0,0 @@ -// Package statik contains static assets for the Web UI. `go generate` will -// produce statik.go, which is ignored by git. -//go:generate statik -src=../webui -dest=.. -package statik diff --git a/statik/filesystem/statik.go b/statik/filesystem.go similarity index 81% rename from statik/filesystem/statik.go rename to statik/filesystem.go index 3f9582a71..6d7fd864f 100644 --- a/statik/filesystem/statik.go +++ b/statik/filesystem.go @@ -11,8 +11,13 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +//go:generate statik -src=../webui -dest=.. +// +// Package statik contains static assets for the Web UI. `go generate` or +// `make generate-statik` will produce statik.go, which is ignored by git. -package filesystem +package statik import ( "net/http"