Goldschmidt, Peralta homer in D-backs' win over Giants