He attended the common schools and Union Academy in Doylestown, Pennsylvania.
He learned the miller’s trade and in 1847 engaged in milling in Doylestown Township. During the American Civil War he served in the Union Army as a private in Company K, One Hundred and Fifty-third Regiment, Pennsylvania Volunteer Infantry, from October 11, 1862, to July 23, 1863. He was an unsuccessful candidate for election to the Pennsylvania State Senate in 1864.
He was elected as an associate judge of Buckinghamshire County in October 1871 and served five years.
Godshalk was elected as a Republican to the Forty-sixth and Forty-seventh Congresses. He returned to milling, and died in New Britain, Pennsylvania.
Member United States House