Every time you perform a normal Google search be thankful for all the people who browse the internet without adblock: they are subsidising you.
Every time you perform a normal Google search be thankful for all the people who browse the internet without adblock: they are subsidising you.
It does cost money, but I kind of doubt this is the reason.
First thing, I assume that Google will continue to have Code Search or something very much like it available internally. The reason is simple: Like many people here said, this kind of search is useful for us programmers. So Google would be silly to not let its people continue to benefit from it. Google is known to have lots of internal tools written to make its developers more productive - this would be just another one.
Second, given that assumption, I wonder how much money it takes to run Code Search publicly. The code is already working, development costs are already paid. How much traffic does it actually receive? I doubt it is that much that it is significant in any way for Google. Google's server infrastructure is very efficient, and the amount of people searching for code isn't that big in absolute terms.
So why would Google be shutting it down? I have no idea. I can throw out a few wild guesses, but don't take them too seriously:
1. Part of a push to limit the amount of Google websites and services - just to keep the number smaller, more coherent, more cohesive.
2. Keeping Code Search an internal tool gives Google another advantage that its developers have that others do not. 2.1. Perhaps Google just finished a major upgrade to Code Search, and decided it wants to keep that internal, and doesn't want to maintain two codebases.
3. Fear of potential legal issues, either 3.1. People suing on the assumption that code appearing in Code Search has been 'scanned' by Google, so Google can't say it never saw that code before, say, in a copyright infringement lawsuit (like the Oracle-Google lawsuit), or 3.2. People using Code Search to find similar pieces of code and using that to sue people. (Both of these legal fears seem ridiculous to me, but lawyers tell their clients to do lots of things that seem ridiculous in order to limit legal liability.)
Again, though, I really have no idea. But I doubt it is money.
(And before anyone starts nitpicking that either of those issues could be solved by just throwing more money at it, money and people aren't actually infinitely fungible).
Then slap a Gogle Payments icon on the page and charge a dime per click. Or a nickel. They can make a pretty penny, no pun intended :)