We’ve been using go-watcher for
local development with docker-compose to automatically rebuild a given service
when its source code changes. From Go 1.20+ onwards the go-watcher
binary no
longer works, because it’s using a build flag -i
which has been deprecated
for a long time, but now is finally removed. Because of that the compilation
fails with error. See it here.
The project is no longer maintained, and it seems that the authors are not going to update it.
Now I’m using a replacement called guard. Usage is almost identical as you can see in the examples below.
Note: we commit vendor, that’s why we build/install with
-mod=vendor
Example Dockerfile using go-watcher
to watch and rebuild a service.
|
|
Example Dockerfile using guard
to watch and rebuild a service.