doggone.
1851, American English, a "fantastic perversion of god-damned " [Weekley].
But Mencken favors the theory that it is "a blend form of dog on it; in fact it is still often used with it following.
It is thus a brother to the old English phrase, "a pox upon it," but is considerably more decorous."