Good enough for government work

What is the origin of the phrase "good enough for government work"? I understand that it may have the opposite meaning in its early days.

I've heard "close enough for government work." And I first heard it in 1978 when I took a government job. It's not a philosophy that I adhere to.