You could do it but the work involved would be immense, the gearboxes are different as well. Also all the engine management system would have to be changed along with the fuel tank and lines as they are different as well. Any benefits of the diesel would be far outweighed by the costs/difficulty.
As the others have said its possible but would cost way too much to have any benefit. You can pretty much put any engine in any car as long as you make the relevant modifications but as it seems your suggesting this to make the cost of fuel cheaper doing such a thing would cost more that staying with petrol. I assume it needs a new engine anyway, otherwise an LPG conversion would be the way to go.
The thing is I already have a diesel engine and a gearbox, it's just the wiring looms and if its possible, getting the job done isnt a problem, I just wanted to know, but all your comments have been helpful.thank you
You may find that the engine mountings are different, especially on smaller cars (not sure about the Golf).
This is because diesels are usually bigger, and they have to squeeze it into a smaller space. For example in the Peugeot 205 they cut a great lump out of the innner wings to recess the mountings into -- you have to take the engine out to do most things, as there's no room at all round it.