Using Sourcegraph To Search Real Code!

What Is Sourcegraph Anyway?

" Sourcegraph is a code search engine that lets you search across hundreds of thousands of libraries and browse code in the same way you can do in a great IDE. "

Sourcegraph is not the first code search engine ever built, neither it will be last, but it offers is completely different from all other code search engines like Nullege, OpenHUB

Why Should You Care?

I will explain a few situations where it makes developers life a little bit easier.

1. Search Real Code:

Sourcegraph helps you to quickly search open source projects & see realcode examples. Let's say I am using Celery to schedule some tasks. I know there is chord (a task that only executes after all of the tasks in a taskset has finished executing) but I don't know how to use it. I can use Sourcegraph to find chord, look at its api, check out some real world examples. 

Here it doesn't sound Sourcegraph is much useful because you can go through the documentation and you can get all the information about it. But you won't find a lot of real world examples in documentation.

Also if you learning about a new module, it will take a while to wrap your head and get used to that module. What you can do is browse through sourcegraph to understand the api & immediately check out some real code where other programmers have used it for various purposes. I feel this helps a lot to start using a new module and get used to it quickly.

2. Bad Documented Libraries:

There are tons of open source libraries & some of them have very good documentation. There are some good libraries which are documented badly or don't have documentation at all. It's a huge pain to to use a library with bad documentation. Here sourcegraph once again comes to rescue us by quickly navigating around the code. 

3. Chrome Extension:

I spend significant time on Github browsing code. Sometimes I clone the repo and browse it on Emacs. But sometimes I just want to browse on Github itself. Sourcegraph has chrome extension which lets you browse code quickly on GitHub by making every identifer a jump-to-definition link. By the way if you are a using it please write a review.

That's if for now. I came across Sourcegraph a couple of weeks back. From then on I am using it almost everyday. Currently it supports only Python, Go, Ruby, Node.js. I hope it will support for other languages soon. What I mentioned here is just a little introduction. Check out ProTips, Sourcegraph docs & srclib(a polyglot code analysis library, built with hackability in mind). If you are a Go programmer, read How do I use Sourcegraph with Go? (a short FREE ebook by Satish Talim).