How can I pass a var between routes funcs and change it in every controller?
问题 I want to pass var and change it globally in every controller between routes so if controller1 change var to "as" I want controller2 to use the new value of the var = "as". How can I do it? something like this main.go: var test []string func NewRouter() *gin.Engine { gin.SetMode(gin.ReleaseMode) r := gin.New() r.GET("/ping", gets(test)) r.Run(":6030") return r } controller.go: func gets(test) gin.HandlerFunc { fn := func(c *gin.Context){ // Here I want to change my var (test) and I want to