I guess either is fine, but "of" writing sounds more natural to me. I'd say if you're ever in this situation in another sentence, go with whatever version won't make your reader pause and say, "Huh?"
' The goal of writing is...' Writing is incapable of having a goal - only the writer can strive towards a goal, so the sentence should be - 'The goal of a writer is to ....' 'The goal in writing is...' may be possible, but still sounds awkward. 'For the writer, the goal is...'
This logic seems a little faulty to me. In this sense, "writing" is an action one does and, I think, capable of having a "goal" for those attempting that action. A writer may have many goals, but his goal of writing one specific document may be different. Since my explanations are sometimes difficult to follow (and often misunderstood), I'll put it to you another way. "Of writing" is a prepositional phrase that modifies the noun, "goal." In other words, it's not that "writing is incapable of having a goal," but that the "goal" is a "writing goal." If that makes sense ... I think I lost myself. For the OP, I would go with "of," but I think lostinwebspace is right, either will work (and I don't think either will stop the reader or be misunderstood).
both can work... it all depends on the context: the goal in writing historical novels is often to enlighten the readers about little-known events the goal of writing my memoirs is a very personal one--revenge!
I agree with previous comments. Both work fine. I prefer: The goal of writing, personally it sounds a bit more general to me. The second one doesn't sound less general, but the the first just sounds more equal. If you get what I'm trying to say.