Whoopi Goldberg, a cohost of "The View," on Tuesday slammed the actress Debra Messing for wanting to publicize a list of attendees at a fundraiser for President Donald Trump, comparing it to McCarthyism.

In response to a story detailing a planned Trump fundraiser in Beverly Hills, California, Messing tweeted on Friday: "Please print a list of all attendees please. The public has a right to know."

"In this country, people can vote for who they want to. That is one of the great rights of this country. You don't have to like it, but we don't go after people because we don't like who they voted for," Goldberg said.

Last month, Rep. Joaquin Castro of Texas was heavily criticized for tweeting a list of prominent individuals and business owners in the San Antonio area who donated large amounts to Trump.

Visit Business Insider's homepage for more stories.

Whoopi Goldberg, a cohost of "The View," slammed the actress Debra Messing for wanting to publicize a list of attendees at a fundraiser for President Donald Trump, comparing it to McCarthyism.

In response to a Hollywood Reporter article detailing a pricey fundraiser that Trump's campaign plans to host in Beverly Hills, California, on September 17, Messing, a vocal opponent of Trump, tweeted on Friday: "Please print a list of all attendees please. The public has a right to know."

On Tuesday's episode of "The View," Goldberg and her cohost Joy Behar sharply criticized Messing and her "Will & Grace" costar Eric McCormack for encouraging the outlet to print the names of the attendees.

"I happen to be against that kind of thing," Behar said. "I do believe that you should know if a company gave a lot of money to Trump in this particular case. I mean, I know some of the names of these companies are going around on Facebook."

But she said that when it comes to individuals, "you're stalking, and you're starting to endanger that person's life."

Read more: The stars of 'Will & Grace' are being called 'fascists' for suggesting a list of attendees to a Hollywood Trump fundraiser should be made public

As their cohost Sunny Hostin noted, however, the names, occupations, employers, and ZIP codes of everyone who donates more than $200 to a candidate for federal office are already publicly available from the Federal Election Commission.

"Listen, the last time people did this, people ended up killing themselves," Goldberg said. "This is not a good idea. Your idea of who you don't want to work with is your personal business. Do not encourage people to print out lists, because the next list that comes out your name will be on, and then people will be coming after you."

She added: "We had something called a blacklist, and a lot of really good people were accused of stuff. Nobody cared whether it was true or not. They were accused. And they lost their right to work. You don't have the right — in this country, people can vote for who they want to. That is one of the great rights of this country. You don't have to like it, but we don't go after people because we don't like who they voted for. We don't go after them that way. We can talk about issues and stuff, but we don't print out lists."

Goldberg was referring to the famous 1950s blacklist of suspected communists during Sen. Joseph McCarthy's "Red Scare." Senate investigations falsely accused hundreds of people, including government workers throughout the federal bureaucracy, of being communists and agents of the Soviet Union.

Messing responded to the criticism by doubling down on her previous tweets.

"I am proud to be a donor when I contribute to a campaign. I am happy to be listed when I attend a fundraiser. I am assuming anyone who donates to Trump's fundraiser would feel the same. Why wouldn't they?" she tweeted on Sunday.

She later shared a link to a Splinter article showing people how to use FEC records to find Trump donors in their area.

Read more: Joaquin Castro was called 'dangerous' by Republicans for tweeting the names of Trump donors, but Democrats say people should be able to follow the money

Trump himself couldn't help but get in a jab at Messing over the weekend, tweeting: "I have not forgotten that when it was announced that I was going to do The Apprentice, and when it then became a big hit, helping NBC's failed lineup greatly, @DebraMessing came up to me at an Upfront & profusely thanked me, even calling me 'Sir.' How times have changed!"

Last month, Rep. Joaquin Castro of Texas was heavily criticized for tweeting a list of prominent individuals and business owners in the San Antonio area who donated large amounts to Trump. While Castro argued that the information was already in the public record and available online, his critics charged that he was subjecting the donors to possible harassment and stalking by further publicizing their names.