How to build a release version binary in Go
refer: https://stackoverflow.com/questions/29599209/how-to-build-a-release-version-binary-in-go
使用命令(生成一个可执行文件)
go build然后把生成的可执行文件进行执行即可。
如果要在生产模式下执行,可以根据提示:
[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)运行:
export GIN_MODE=release然后执行可执行文件即可。