From 9f1349d6a0ed7ea540193f07df29863f88006c03 Mon Sep 17 00:00:00 2001 From: maru Date: Wed, 17 Apr 2024 21:11:53 -0400 Subject: [PATCH] Move gob Register functions to pokerogue-server.go --- api/endpoints.go | 4 ---- pokerogue-server.go | 6 ++++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/api/endpoints.go b/api/endpoints.go index 85c082b..ce17889 100644 --- a/api/endpoints.go +++ b/api/endpoints.go @@ -2,7 +2,6 @@ package api import ( "encoding/base64" - "encoding/gob" "encoding/json" "fmt" "log" @@ -32,9 +31,6 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { s.Exit.RLock() defer s.Exit.RUnlock() - gob.Register([]interface{}{}) - gob.Register(map[string]interface{}{}) - if s.Debug { w.Header().Set("Access-Control-Allow-Headers", "*") w.Header().Set("Access-Control-Allow-Methods", "*") diff --git a/pokerogue-server.go b/pokerogue-server.go index 6d8af7c..acd901c 100644 --- a/pokerogue-server.go +++ b/pokerogue-server.go @@ -1,6 +1,7 @@ package main import ( + "encoding/gob" "flag" "log" "net" @@ -29,6 +30,11 @@ func main() { flag.Parse() + + // register gob types + gob.Register([]interface{}{}) + gob.Register(map[string]interface{}{}) + // get database connection err := db.Init(*dbuser, *dbpass, *dbproto, *dbaddr, *dbname) if err != nil {