Browse Source

拼写错误

luoyangwei 1 year ago
parent
commit
510b383970
1 changed files with 5 additions and 3 deletions
  1. 5 3
      websocket.go

+ 5 - 3
websocket.go

@@ -22,7 +22,7 @@ import (
 )
 )
 
 
 var name = flag.String("n", "w303", "the name of the server")
 var name = flag.String("n", "w303", "the name of the server")
-var prot = flag.Int64("p", 8080, "the port of the server")
+var port = flag.Int64("p", 8080, "the port of the server")
 var nodeId = flag.Int64("i", 1, "the node id of the server")
 var nodeId = flag.Int64("i", 1, "the node id of the server")
 var configFile = flag.String("f", "./etc/websocket.toml", "the config file")
 var configFile = flag.String("f", "./etc/websocket.toml", "the config file")
 
 
@@ -32,11 +32,13 @@ func main() {
 	flag.Parse()
 	flag.Parse()
 	gid.SetNodeId(*nodeId)
 	gid.SetNodeId(*nodeId)
 	config.MustLoadConfig(*configFile)
 	config.MustLoadConfig(*configFile)
-	port := fmt.Sprintf(":%d", *prot)
+	port := fmt.Sprintf(":%d", *port)
 	log.Println("Server start at ", port)
 	log.Println("Server start at ", port)
 
 
 	app := newApp()
 	app := newApp()
-	app.Run(fmt.Sprintf(":%d", prot))
+	if err := app.Run(port); err != nil {
+		log.Fatalln(err)
+	}
 }
 }
 
 
 func newApp() *gin.Engine {
 func newApp() *gin.Engine {