From 292c497747d7818d2042747db350b9c2dcb17433 Mon Sep 17 00:00:00 2001 From: Mohamed Meabed Date: Wed, 3 Oct 2018 21:05:49 +0400 Subject: [PATCH] fix: Update Gopkg and add handleStatic function to main.go --- Gopkg.lock | 16 ++-------------- cmd/server/main.go | 7 ++++++- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 5f663d4..d9f76d1 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -1,14 +1,6 @@ # This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. -[[projects]] - digest = "1:320e7ead93de9fd2b0e59b50fd92a4d50c1f8ab455d96bc2eb083267453a9709" - name = "github.com/asaskevich/govalidator" - packages = ["."] - pruneopts = "UT" - revision = "ccb8e960c48f04d6935e72476ae4a51028f9e22f" - version = "v9" - [[projects]] digest = "1:b520b55fc1146c5b0eea03b07233f7a3d4a9be985c037c91ea6b82ecb81bd521" name = "github.com/bitly/go-simplejson" @@ -26,12 +18,9 @@ version = "v1.1.1" [[projects]] - digest = "1:aa047c900450fea2242fbb449076eb20cea8278f3b15d2db1950a3c8da8e4308" + digest = "1:c116114869f44c711fa5baf9e019fa327101c82ddc4dcc1de84db1f6c43a2d36" name = "github.com/go-ozzo/ozzo-validation" - packages = [ - ".", - "is", - ] + packages = ["."] pruneopts = "UT" revision = "106681dbb37bfa3e7683c4c8129cb7f5925ea3e9" version = "v3.5.0" @@ -83,7 +72,6 @@ input-imports = [ "github.com/bitly/go-simplejson", "github.com/go-ozzo/ozzo-validation", - "github.com/go-ozzo/ozzo-validation/is", "github.com/go-redis/redis", "github.com/op/go-logging", "github.com/stretchr/testify/assert", diff --git a/cmd/server/main.go b/cmd/server/main.go index e509665..62635a0 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -94,9 +94,10 @@ func serveHTTP(host string, port int) { mux := http.NewServeMux() for k, v := range routes { mux.HandleFunc(k, v) - mux.Handle(`/`, http.FileServer(http.Dir(*staticPath))) } + handleStatic(mux) + addr := fmt.Sprintf("%v:%d", host, port) server := &http.Server{ Addr: addr, @@ -111,3 +112,7 @@ func serveHTTP(host string, port int) { err := server.ListenAndServe() Logger.Error(err.Error()) } + +func handleStatic(mux *http.ServeMux) { + mux.Handle(`/`, http.FileServer(http.Dir(*staticPath))) +}