

Depending on where you live, you may or may not be protected by a shield law. But, it is important to note, that even if your state does have a shield law, you should never rely on the shield law.
With that said, there is no absolute protection for journalists. Depending on the circumstances, you may or may not be required to release names of sources or other information. Yes, the government must prove that the information is relevant, that the information can‘t be obtained elsewhere, and that there is a compelling public interest in the information. And, although it may be difficult to prove all three in some cases, it is not impossible.
It is important to note that if you break a confidentiality contract with a source, you may be sued.
In Cohen v. Cowles Media Co., Cohen, a public relations consultant in a political campaign, gave two newspapers information about a candidate. Cohen requested that his name not be printed because it could jeopardize his job.
The newspaper printed Cohen's name, and Cohen sued.
full text of Cohen v. Cowles Media Co.