Minecraft wiki entry for Door-based_iron_golem_farming, associated text: At the end of the tunnel, build some access to the surface (shown in the first image on the lower right). Villagers are free to go in and out, but make a barrier in the tunnel to keep them from reaching the lava.