Understanding proof that a contour integral along a closed path of a holomorphic function is zero One of our tutorial questions in complex analysis asked us to prove that: $\int_\gamma g = 0$ for any holomorphic function $g$ on $\Omega$, and $\gamma: [a,b] \rightarrow \Omega$, which is simple and positively oriented.
The proof was really a one liner, noting that if $g$ is holomorphic on $\Omega$, then so is $g(z) = g(z)(z-a)$ for any interior point, $a$, of the path. Then we just say since $\int_\gamma g = \int_\gamma \frac{g(z)(z-a)}{z-a}dz$ (*), then $\int_\gamma g = 0$ by the CIF.
Looking over the problem again I am hoping to clarify my actual understanding of why the (*) step is valid. I initially thought the step was trivial; I just took $g(z) = \frac{g(z)(z-a)}{z-a}$. But a moment of reflection when I reviewed the problem made me realise it's not so straightforward, because these two functions are not actually equal; the function defined by the latter has an undefined point in $\Omega$, namely at $z = a$.
Is my new reasoning below the correct justification?:
The functions given by $g(z)$ and $g(z)(z-a)$ differ at a single point $z=a$. Suppose that $\gamma (t_a) = a$, and note by definition $\int_\gamma g := \int_a^b g(\gamma(t))\gamma'(t)dt$.
Then since $\int_\gamma g(z)dz$ can be written as a real integral, and since $\frac{g(z)(z-a)}{z-a}$ differs at just a single point from $g(z)$, the real integral given by $\int_a^b g(\gamma(t))\gamma'(t)dt$, is equal to the contour integral $\int_\gamma \frac{g(z)(z-a)}{z-a}dz$, since the value of integrals remain unchanged for any countable difference of points in the function.
I am just wondering of this makes sense since we have to change the domains, i.e. the undefined point becomes the real number $\gamma(t_a)$ in the real integral, rather than the complex number $a$ (although I hope it is fine, and I don't see an issue currently).
The result you say you want to prove is false (the proofs that have appeared require more assumptions than what's given).
Let $\Omega=\{z:z\ne0\}$, $g(z)=1/z$, $[a,b]=[0,2\pi]$ and $\gamma(t)=e^{it}$. Then $$\int_\gamma g(z)\,dz=2\pi i.$$
Note
This is a hugely important example, worth keeping in mind: (i) It explains where the Residue Theorem comes from (ii) in a sense the function $1/(z-a)$ for $a\notin\Omega$ is the only counterexample (or rather if none of those functions is a counterexample then there is no counterexample):
Theorem. Suppose $\gamma$ is a (smooth) closed curve in the open set $\Omega\subset\Bbb C$. TFAE:
(i) $\int_\gamma f=0$ for all $f\in H(\Omega)$.
(ii) $\int_\gamma f=0$ if $f(z)=1/(z-a)$ for some $a\in\Bbb C\setminus\Omega$.
(iii) $Ind(\gamma, a)=0$ for all $a\in\Bbb C\setminus\Omega$.
Proof: (ii) is a special case of  (i). If you write $Ind$ as an integral it's clear that (ii) and (iii) are equivalent. And CT says precisely that (iii) implies (i).
The proof I know using Green's theorem.
If $f(z)$ is holomorphic on $D$ and $\gamma$ is a closed contour on this domain $\oint_\gamma f(z)\ dz = 0$
$f(z) = u(x,y) + iv(x,y)\\
dz = dx + i\ dy\\$
$\oint_\gamma f(z)\ dz\\ = \int (u+iv)(dx + i\ dy)$
Which we multiply out and break into real and imaginary parts.
$\int u\ dx - v\ dy + i\int v\ dx + u\ dy$
Greens theorem says over any closed contour.
$\oint P\ dx + Q\ dy = \iint \left(\frac {\partial Q}{\partial x} -\frac {\partial P}{\partial y}\right) \ dx\ dy$
And if we apply it to each of the integrals above.
$\int -\left(\frac {\partial v}{\partial x} + \frac {\partial u}{\partial x}\right) \ dx \ dy + i\int \left(\frac {\partial u}{\partial x} - \frac{\partial v}{\partial y}\right) \ dx \ dy$
But the Cauchy-Riemann equations say that for a holomorphic function
$\frac {\partial u}{\partial x} = \frac{\partial v}{\partial y}\\
\frac {\partial v}{\partial x} = - \frac {\partial u}{\partial x}$
Making both integrals equal to zero.