From 0a6f2d07f6d39b31605edb3c5702fc529a93d87b Mon Sep 17 00:00:00 2001 From: Cody Soyland Date: Thu, 8 Mar 2018 08:38:29 -0600 Subject: [PATCH] Move statik filesystem implemention to subpackage of statik package. --- Makefile | 4 ++-- handler.go | 2 -- handler_test.go | 4 ++-- server/server.go | 4 ++-- statik/.gitignore | 2 +- statik/doc.go | 1 + statikfs/filesystem.go => statik/filesystem/statik.go | 2 +- 7 files changed, 9 insertions(+), 10 deletions(-) rename statikfs/filesystem.go => statik/filesystem/statik.go (98%) diff --git a/Makefile b/Makefile index b1b545042..8fdbcea3d 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: dep docker pilosa release-build prerelease-build release prerelease prerelease-upload install generate statik test cover cover-pkg cover-viz clean docker-build docker-test +.PHONY: dep docker pilosa release-build prerelease-build release prerelease prerelease-upload install generate generate-statik generate-protoc statik test cover cover-pkg cover-viz clean docker-build docker-test DEP := $(shell command -v dep 2>/dev/null) STATIK := $(shell command -v statik 2>/dev/null) @@ -103,7 +103,7 @@ generate-protoc: .protoc-gen-gofast go generate github.com/pilosa/pilosa/internal generate-statik: statik - go generate github.com/pilosa/pilosa + go generate github.com/pilosa/pilosa/statik generate: generate-protoc generate-statik diff --git a/handler.go b/handler.go index 067219c8f..e4a707d8f 100644 --- a/handler.go +++ b/handler.go @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:generate statik -src=./webui - package pilosa import ( diff --git a/handler_test.go b/handler_test.go index 4f3f12f77..5d8af43a9 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" - "github.com/pilosa/pilosa/statikfs" + statik "github.com/pilosa/pilosa/statik/filesystem" "github.com/pilosa/pilosa/test" ) @@ -1854,7 +1854,7 @@ func TestHandler_WebUI(t *testing.T) { h := test.NewHandler() h.Holder = hldr.Holder h.Cluster = test.NewCluster(1) - h.FileSystem = &statikfs.FileSystem{} + h.FileSystem = &statik.FileSystem{} w := httptest.NewRecorder() h.ServeHTTP(w, test.MustNewHTTPRequest("GET", "/", nil)) diff --git a/server/server.go b/server/server.go index 52df0e52e..67498d7d4 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" - "github.com/pilosa/pilosa/statikfs" + statik "github.com/pilosa/pilosa/statik/filesystem" "github.com/pilosa/pilosa/statsd" ) @@ -193,7 +193,7 @@ func (m *Command) SetupServer() error { m.Server.Cluster.RemoteClient = c // Statik file system. - m.Server.Handler.FileSystem = &statikfs.FileSystem{} + m.Server.Handler.FileSystem = &statik.FileSystem{} // Default coordintor to port 0 when not specified so that coordinator // can be set to the value of server.URI after server binds to a port. diff --git a/statik/.gitignore b/statik/.gitignore index 514ee40a1..485c0c57d 100644 --- a/statik/.gitignore +++ b/statik/.gitignore @@ -1 +1 @@ -statik.go +/statik.go diff --git a/statik/doc.go b/statik/doc.go index 85edd9e6f..9310eb508 100644 --- a/statik/doc.go +++ b/statik/doc.go @@ -1,3 +1,4 @@ // 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/statikfs/filesystem.go b/statik/filesystem/statik.go similarity index 98% rename from statikfs/filesystem.go rename to statik/filesystem/statik.go index 306034a1f..3f9582a71 100644 --- a/statikfs/filesystem.go +++ b/statik/filesystem/statik.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package statikfs +package filesystem import ( "net/http"