Gonzalez retired from football in 2019 and is best remembered for his spell at Anfield in the 2006/2007 season when Rafael Benitez was in charge of the Reds.
The 36-year-old, who made 25 appearances and scored two goals for Liverpool, also turned out for the likes of Real Sociedad, Real Betis and CSKA Moscow in Russia.
Announcing the sad news on Instagram, Rivera said: “The love of my life, my soul mate, what a shock you have given me. The past few nights have been terrible. Days filled with uncertainty, it’s been really frightening.
“I am writing this as you are still here with us and a little better — and because in many ways, the fact that you are still here with us, makes us cherish every moment we have together, family and above all, life itself.
“It’s amazing how everything can change from one moment to the next. Life can surprise us and test us, instill fear, but with faith, strength and hope, we can come out of all of the bad moments. I want you to be with me forever, Mark.”
Liverpool have tweeted a message of support for the former Chile international, writing: "We're sending all of our best wishes to former Red, Mark González, who is recovering after suffering a heart attack. Everyone at the Reds wishes you a quick recovery, Mark".
Gonzalez won 56 caps for Chile and was part of the side that won the Copa America in 2016.