diff --git a/Makefile b/Makefile index 3d33b92..51cc352 100644 --- a/Makefile +++ b/Makefile @@ -39,6 +39,8 @@ run: $(BINARY) ./$(BINARY) -vv serve $(BINARY): $(SOURCE) $(ROUTE_ASSET) $(VENDOR_FILES) $(DOCS_ASSET) + go vet ./... + go test ./... go build "sour.is/x/paste/cmd/paste" $(ROUTE_ASSET): $(ROUTE_FILES) diff --git a/cmd/paste/config.go b/cmd/paste/config.go index 4fbda61..779ecd3 100644 --- a/cmd/paste/config.go +++ b/cmd/paste/config.go @@ -72,7 +72,7 @@ func init() { } if args["-v"].(int) == 2 { log.SetVerbose(log.Vdebug) - log.SetFlags(log.LstdFlags|log.Lshortfile) + log.SetFlags(log.LstdFlags | log.Lshortfile) log.Debug("Debug Logging.") } diff --git a/cmd/paste/main.go b/cmd/paste/main.go index e684f63..e2d59ea 100644 --- a/cmd/paste/main.go +++ b/cmd/paste/main.go @@ -27,13 +27,13 @@ package main // import "sour.is/x/paste/cmd/paste" import ( + "os" + "os/signal" _ "sour.is/x/paste/src/docs" _ "sour.is/x/paste/src/routes" "sour.is/x/toolbox/httpsrv" - "os" - "os/signal" - "syscall" "sour.is/x/toolbox/log" + "syscall" ) func main() { diff --git a/src/docs/public.go b/src/docs/public.go index 658396b..d672875 100644 --- a/src/docs/public.go +++ b/src/docs/public.go @@ -4,7 +4,7 @@ import "sour.is/x/toolbox/httpsrv" func init() { httpsrv.AssetRegister("docs", httpsrv.AssetRoutes{ - {"Assets", "/docs/", httpsrv.FsHtml5(assetFS())}, + {Name: "Assets", Path: "/docs/", HandlerFunc: httpsrv.FsHtml5(assetFS())}, }) } diff --git a/src/routes/paste.go b/src/routes/paste.go index 70dad29..5b045cf 100644 --- a/src/routes/paste.go +++ b/src/routes/paste.go @@ -27,15 +27,15 @@ func init() { httpsrv.RegisterModule("paste", setConfig) httpsrv.HttpRegister("paste", httpsrv.HttpRoutes{ - {"getRandom", "GET", "/paste/rng", getRandom}, - {"getPaste", "GET", "/paste/{id}", getPaste}, - {"getPaste", "GET", "/paste/get/{id}", getPaste}, - {"postPaste", "POST", "/paste", postPaste}, + {Name: "getRandom", Method: "GET", Pattern: "/paste/rng", HandlerFunc: getRandom}, + {Name: "getPaste", Method: "GET", Pattern: "/paste/{id}", HandlerFunc: getPaste}, + {Name: "getPaste", Method: "GET", Pattern: "/paste/get/{id}", HandlerFunc: getPaste}, + {Name: "postPaste", Method: "POST", Pattern: "/paste", HandlerFunc: postPaste}, - {"getRandom", "GET", "/api/rng", getRandom}, - {"getPaste", "GET", "/api/{id}", getPaste}, - {"getPaste", "GET", "/api/get/{id}", getPaste}, - {"postPaste", "POST", "/api", postPaste}, + {Name: "getRandom", Method: "GET", Pattern: "/api/rng", HandlerFunc: getRandom}, + {Name: "getPaste", Method: "GET", Pattern: "/api/{id}", HandlerFunc: getPaste}, + {Name: "getPaste", Method: "GET", Pattern: "/api/get/{id}", HandlerFunc: getPaste}, + {Name: "postPaste", Method: "POST", Pattern: "/api", HandlerFunc: postPaste}, }) } diff --git a/src/routes/public.go b/src/routes/public.go index bc4e093..e8bf60b 100644 --- a/src/routes/public.go +++ b/src/routes/public.go @@ -4,7 +4,7 @@ import "sour.is/x/toolbox/httpsrv" func init() { httpsrv.AssetRegister("paste", httpsrv.AssetRoutes{ - {"Assets", "/", httpsrv.FsHtml5(assetFS())}, + {Name: "Assets", Path: "/", HandlerFunc: httpsrv.FsHtml5(assetFS())}, }) }