We present real time atomic force microscopy imaging during nanogap fabrication by feedback controlled electromigration of a gold nanowire. The correlated measurements of electrical resistance and atomic force microscopy reveal that the major structural changes appear at the early stage of the process. Moreover, despite important morphological changes, the resistance of the nanowire shows a weak increase of just a few ohms. The detailed analysis of the atomic force microscopy images clearly shows that the electromigration process is strongly influenced by the initial microstructure of the nanowire.