The magma that became a granitic intrusion may have provided the heat source (and the sulfur) that leached the gold out of mafic or felsic volcanics / sediments and formed the gold deposit.
Gold can occur in Skarn deposits in grades that are economic. Skarns are typically formed at the contact of intrusive granitic magma and carbonate sedimentary rocks such as limestone or dolomite.
There is a few relation. The gold is more related to intermediate composition intrusives.
Meinert, L. D., 1995, Compositional variation of igneous rocks associated with skarn deposits - Chemical evidence for a genetic connection between petrogenesis and mineralization. In (Ed.) Thompson, J. F. H., Magmas, Fluids, and ore deposits. Mineralogical Association of Canada. Short series, 23. pp. 401-418.
Wilkinson, J. J., 2013, Triggers for the formation of porphyry ore deposits in magmatic arcs. Nature Geoscience, 6, pp. 917-925.
Gold is a rare element whose crustal abundance is very low, i.e. 0.004 ppm, also signifying very low concentration in magmas. However, during fractional crystallization, gold is progressively enriched in the rest fluid. Although gold, according to Goldschmidt classification, is primarily siderophile in character, in water-rich silicate melts the gold becomes hydrophilic, i.e. it has more affinity for water and becomes partitioned preferentially in the aqueous phase. Also, as fractional crystallization proceeds to produce granitic rock compositions, the rest fluid becomes more enriched in aqueous phase, hence more enriched in gold. With intrusion and solidification of the granitic magma, the rest fluid now enriched in gold is emplaced as veins in the upper zones of the intrusion or in the country rocks that form the roof of the granitic intrusion. Typically the gold deposits would be in quartz veins and associated hydrothermal alterations.
As you know Gold has a high density and many researchers believe that it has been concentrated in the core of the earth, and in the upper parts the earth the clarke of Au is not high, so we can not say that the granites are the source of Gold. The point is here, the granitic magma has a higher content of waters and fluid phase comparing the mafic magma and the transportation of Au can be done easily in the acidic and intermediate melts comparing to the mafic phase.