friendsofgo / killgrave

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

Fix watcher mode #149

Closed joanlopez closed 1 year ago

joanlopez commented 1 year 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