如何将杜松子酒模式设置为释放模式?

I've just started learning Go.

I need to set gin mode to release mode. How should I do it? Now when I run my API there is a hint like this:

[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
 - using env:   export GIN_MODE=release
 - using code:  gin.SetMode(gin.ReleaseMode)

I tried gin.SetMode(gin.ReleaseMode) but it does not work. I initialize my router here:

gin.SetMode(gin.releaseMode)    
router := gin.Default()

It would seem you do this by calling the SetMode method from within your app. Probably in your main, or possibly in an init function.

Just add gin.SetMode(gin.ReleaseMode) in your main function.

Just set GIN_MODE=release to your environment config.

You have to call SetMode method before you initialize the gin router. E.x:

gin.SetMode(gin.ReleaseMode)
router := gin.New()