dougong7850 2018-06-10 02:05
浏览 345
已采纳

golang可以在开发模式下热插拔吗?

For production environment, I can accept that golang can not hot swap. But for development mode, must I recompile whole project, and restart server, even just modify 1 line of code? Is there any way to quickly hot swap code to check result for debugging?

  • 写回答

1条回答 默认 最新

  • dongren7374 2018-06-10 03:08
    关注

    You use or create a watcher process that looks for changes, will recompile and restart the server when it identifies a change.

    Here are some examples of this. I use Beego and bee rebuilds my server during development all the time.

    Gin

    gin is a simple command line utility for live-reloading Go web applications. Just run gin in your app directory and your web app will be served with gin as a proxy. gin will automatically recompile your code when it detects a change. Your app will be restarted the next time it receives an HTTP request.

    Fresh

    Fresh will watch for file events, and every time you create/modify/delete a file it will build and restart the application. If go build returns an error, it will log it in the tmp folder.

    Fresh works specifically with Traffic, Martini and gocraft/web.

    Beego bee

    The Beego web framework also does this. This is implemented in bee, a CLI tool for running Beego.

    bee will watch all the project directories by default and has an option to also watch the vendor directory.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记