From a246196786d2042d66380011530abb382aa24744 Mon Sep 17 00:00:00 2001 From: MichaelOultram Date: Thu, 30 Jul 2015 14:17:01 +0100 Subject: [PATCH] Fixing build issues --- web.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/web.go b/web.go index 026ae17..56a302e 100644 --- a/web.go +++ b/web.go @@ -28,14 +28,17 @@ type Page struct { var external_ip = "" func Webserver(port int) *WebServer { - var webserver = WebServer{port, make(map[*gumble.User]string), make(map[string]*gumble.User)} - http.HandleFunc("/", webserver.homepage) - http.HandleFunc("/add", webserver.add) - http.HandleFunc("/volume", webserver.volume) - http.HandleFunc("/skip", webserver.skip) - http.ListenAndServe(":"+strconv.Itoa(port), nil) + return WebServer{port, make(map[*gumble.User]string), make(map[string]*gumble.User)}.construct() +} + +func (web *WebServer) construct() *WebServer { + http.HandleFunc("/", web.homepage) + http.HandleFunc("/add", web.add) + http.HandleFunc("/volume", web.volume) + http.HandleFunc("/skip", web.skip) + http.ListenAndServe(":"+strconv.Itoa(web.port), nil) rand.Seed(time.Now().UnixNano()) - return webserver + return web } func (web *WebServer) homepage(w http.ResponseWriter, r *http.Request) {