在文件更改时自动重新编译并重新加载服务器 [英] Go Auto-Recompile and Reload Server on file change

查看:121
本文介绍了在文件更改时自动重新编译并重新加载服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道AppEngine可以做到这一点,但是我没有为此编写代码.

I know AppEngine does this, but I'm not coding for it.

我尝试使用Ruby world中的Guard来监听.go文件上的更改,并执行以下命令:

I tried using Guard from Ruby world, to listen on changes on .go files, and execute the following commands:

killall foo
go build -race
./foo &

但是它永远不会将foo发送到后台,只是无限期地挂起.

But it never sends foo into background, it just hangs indefinitely.

你们如何解决这个问题?解决方案也必须跨平台(GNU/Linux和Mac).

How are you guys solving this problem? Solution has to be cross-platform too (GNU/Linux and Mac).

推荐答案

一个朋友为go编写了一个简单的Compile Daemon,对我自己的小型net/http-projects来说就像一个魅力.

A friend wrote a simple Compile Daemon for go, worked like a charm for my own small net/http-projects.

您可以在此处找到存储库: https://github.com/githubnemo/CompileDaemon

You can find the repository here: https://github.com/githubnemo/CompileDaemon

这篇关于在文件更改时自动重新编译并重新加载服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆