Working with microservices can be a pain, especially when one change can require multiple places to update. You have to check various repositories for occurrences of the piece of code you need to change. What can you do in that situation?
- Open all your repos in your favourite editor at once
- Use GitHub's search
- Open each and every one of your repos and search manually
- Follow instructions below and start using Hound
Hound is an extremely fast source code search engine. The core is based on this article (and code) from Russ Cox: Regular Expression Matching with a Trigram Index. Hound itself is a static React frontend that talks to a Go backend. The backend keeps an up-to-date index for each repository and answers searches through a minimal API.
And here's how it works!
Here's what you do:
- Go to the folder you want to keep the configs for Hound, for me it was
- Create a
config.jsonfile, that points to your local repositories, like this
docker run -d -p 6080:6080 --name hound -v $(pwd):/data -v ~/code:/code etsy/hound. Please remember that if the folder you keep your repos at is named differently, you have to adjust it in the
config.jsonand in the docker command, specifically
- Go to
localhost:6080& enjoy your quick search!
Bonus: Hound has integrations with Sublime, Vim, Emacs & Visual Studio code so you don't have to leave your favorite editor!