That's different. You can't perfectly detect all infinite loops in a language that allows arbitrary loops. This also means you can't perfectly detect unreachable code.
But determining that a function (such as panic) is never called because there are no calls to it is pretty easy.