DEV Community

Cover image for Getting instant feedback on your go code changes
Bhupinder Singh Narang
Bhupinder Singh Narang

Posted on

Getting instant feedback on your go code changes

A typical workflow of a Go development is we add some code in the project, compile it and see if the results match our expectations. Some cautious developers choose to make very small change at a time and repeat the above cycle and this a again a personal preference. But steps like (1) compiling changed code, (2) Execution and (3) exiting the process is kind of exhaustive as you tend to repeat this monotonous cycle all the time.

What if you could see the results due to changes instantly without having to repeat the above cycle. The tool I am using extensively is called go-watcher which has increased my productivity

https://github.com/canthefason/go-watcher

Alt Text

From the repository authors:

Watcher is a command line tool inspired by fresh and used for watching .go file changes, and restarting the app in case of an update/delete/add operation.

The way it works is - It continuously watches your project directory and on any change in your code when saved, restart the app which means you can cut down the steps of binary building, execution and killing of the app.

To get this tool, do:

go get github.com/canthefason/go-watcher

After it's installed, you can go to terminal in the project directory and execute `watcher'

Hope this productivity tip has helped.

Thanks for reading it. Happy to know what is your favorite productivity hack for #Go?

Top comments (0)