Investigators say Godette then used the officer's keys to get out of the building.
Wayne County deputies and the Goldboro Police Department used tracking dogs to trace Godette to the West Haven area where he was quickly captured.
The officer he allegedly attacked was treated and released from the hospital. Godette now faces felony charges.
The Sheriff's Office says security procedures in the court house have been changed, and officers will no longer carry keys that a prisoner can use to get outside.