Goldschmidt homers as Cardinals beat Diamondbacks 5-2