What is $\int_{\gamma}\int_{0}^{1} \frac{g(t) \, dt}{t-z}\,dz$ in terms of $I=\int_{[0,1]}g$ for a closed piecewise smooth curve $\gamma$.
$$ \int\limits_\gamma \int_0^1 \frac{g(t)}{t-z} \, dt \,dz $$ Since the curve along which $z$ moves is continuous, and is the image of the compact set $[0,1],$ and is disjoint from the set $[0,1],$ there is some positive number $\eta$ such that $|t-z|>\eta$ for every $t\in[0,1]$ and every $z$ on the curve. In other words, the denominator $t-z$ does not approach $0$ anywhere, so the function $(t,z)\mapsto 1/(t-z)$ is bounded. And $g$ is a continuous function on the compact set $[0,1],$ so it is also bounded. Therefore the order of integration can be changed with impunity, getting $$ \int_0^1 \int\limits_\gamma \frac{g(t)}{t-z} \, dz \,dt. $$ As $z$ moves along the curve $\gamma,$ $t$ does not change, so the above is equal to $$ \int_0^1 \left( g(t) \int\limits_\gamma \frac{dz}{t-z} \right) \, dt $$ Now recall that \begin{align} & \int\limits_\gamma \frac{dz}{t-z} \\[8pt] = {} & \big( {-2}\pi i \times(\text{the number of times $\gamma$ winds around $t$}) \big) \end{align} So the integral you seek is $$ -2\pi i\times \int_0^1 g(t)\, dt \times (\text{the winding number}). $$