friendsofgo / killgrave

Simple way to generate mock servers written in Go
https://friendsofgo.github.io/killgrave/
MIT License
511 stars 96 forks source link

Fix watcher mode #149

Closed joanlopez closed 10 months ago

joanlopez commented 10 months ago

The watcher mode (-w) is working only partially because once there's a change detected, it shut downs the existing server and initializes another one, but doesn't update the reference, so on the following updates, the newer server is not being shutdown, causing bind: address already in use error.

So, this PR basically ensures that the watcher callback updates the reference to the server with the new one on every "restart" (after every event detected by the watcher).

Fixes #148