Where does one use holomorphicity in the proof of Goursat's theorem? Goursat's theorem: Let $f : U \to \mathbb{C}$ be a function that is holomorphic on the open set $U$. If $T$ is a triangle in $U$ and $\gamma$ is some smooth parametrization of that triangle, then $\int_{\gamma} f = 0$. 
My question: Is this no longer true if I replace holomorphic with differentiable?
The proof I am reading proceeds by dividing $T$ into quarter triangles, and arguing that the integral over $T$ must be bounded above by 4 times the integral of one of the quarter triangles. The argument proceeds by induction to show that this bound forces the integral over $T$ to vanish. 
There seems to be only one place where the assumption that $f$ is holomorphic is used - namely, we use it to write $f(z) = f(z_0) + f'(z_0)h + h \phi(h)$, with $h = (z - z_0)$ $\phi(h)$ converging to zero as $h \to 0$. Let $T^n$ be the $nth$ triangle chosen in the typical method of proof. $p^n$ denotes its perimeter, and $d^n$ the diameter.
Supposing that $f$ was merely $R^2$ differentiable, I can create a similar expression: $f(z) = f(z_0) + f'(z_0)(h) + |h| \phi(h)$, and conclude that $\int_{T^n} f(z) =  \int_{T^n} (f(z_0) + f'(z_0)(h)) + \int_{T^n} (|h| \phi(h))$. 
I want to claim that  $(f(z_0) + f'(z_0)(h))$ has a primitive since it is the sum of a constant function and a linear function (however, I think that the constant part has no primitive, since it is a vector and not scalar, so it is not the derivitive of $"f(z_0) x"$ - this is wrong, see below), so that we are left with $\int_{T^n} f(z) = \int_{T^n} (|h| \phi(h)) \leq \sup (|h| \phi(h)) p^{(n)}$ ($p^n$ is the perimeter of $T^n$).
Since $\sup |h| \phi(h) \leq d^n \sup \phi(h)$, it seems like the same exact proof goes through as in the holomorphic case.
Can someone help me find my mistake?
 A: When you have a statement you know is incorrect, but you think you have a proof, it is always a good idea to see what happens when you apply your proof to an explicit counterexample.  In this way, you should be able to find the mistake or misconception.
In this case, one of the easiest counterexamples is $f(z) = \overline{z}$ (the complex conjugate).  Take the triangle to be the real axis from $0$ to $1$, the diagonal line from $1$ to $i$, and then the imaginary axis from $i$ to $0$.  The integral should have value equal to $i$ (if I haven't miscalculated), rather than $0$.  Now try to see where your argument goes wrong!

Added:  for this kind of question, it is helpful to think of the domain copy of $\mathbb C$ as being $\mathbb R^2$ (so depending on two parameters), but the
target copy of $\mathbb C$ as just being $\mathbb C$, a field of scalars.
In other words, we think of complex valued functions of two real variables.
Now we usually work in terms of $\partial_x$ and $\partial_y$ when studying functions on $\mathbb R^2$, but when the functions are complex valued, we can instead work in terms of $\partial_z :=  \dfrac{1}{2}(\partial_x - i \partial_y)$ 
and $\partial_{\overline{z}} := \dfrac{1}{2}(\partial_x + i \partial_y).$
If $F$ is any (sufficiently differentiable) function, and $\gamma$ is a path between two complex numbers $a$ and $b$, we then find that 
$$\int_{\gamma} \partial_z F(z) d z + \int_{\gamma} \partial_{\overline{z}} F(z)  d\overline{z} = F(b) - F(a).$$
You can check this for yourself; it is just a rewriting of the (probably) more
familiar formula  $$ \int_{\gamma} \partial_x F(z) dx + \int_{\gamma} \partial_y
F(z) dy = F(b) - F(a).$$
When you are looking for a "primitive" to compute a line integral $\int_{\gamma} f(z) dz,$ then, what you are trying to do is to write $f(z)$ as $\partial_z F(z)$
for some $F(z)$ which satisfies $\partial_{\overline{z}} F = 0$ identically, 
and then apply the above formula.    
This isn't always possible, anymore then it is possible to always write a function
of two variables as $\partial_x$ of some function whose $\partial_y$ vanishes.
Indeed, the Cauchy--Riemann equations can be expressed as saying that
$\partial_{\overline{z}} F = 0$ at every point.    You can further check
that, for a holomorphic functions, $\partial_z$ is just the usual complex derivative.
So if you can find a "primitive" $F$for $f$ as above, then $F$ is holomorphic, and hence so is $f$ (being the derivative of a holomorphic function).  So you can find a primitive, and hence get integral zero, precisely in the holomorphic case.

The discussion is perhaps easier when expressed in terms of differential forms,
if you know that language.  Then we have the formula, for smooth functions on $\mathbb R^2$:
$$\int_{\gamma} dF  =  F(b) - F(a)$$
(the one-dimensional form of Stokes's theorem, which I guess classically is just the fundamental theorem of calculus), 
and we can write $dF$ either as $\partial_x F dx + \partial_y F dy,$
or instead as $\partial_z F dz + \partial_{\overline{z}}F d\overline{z}$.
(It is just a question of choosing $dz$ and $d\overline{z}$ as a basis
for the complexified one-forms, rather than $dx$ and $dy$.)
We also have the formula, for a closed curve $\gamma$ bounding a region $\Delta$,
that
$$\int_{\gamma} f dz = \int_{\Delta} d(f dz) = \int_{\Delta} \partial_{\overline{z}}
f d\overline{z} \wedge dz$$
(the two-dimensional form of Stokes's theorem, I guess classically known as
Green's theorem in the plane).
Now one computes $d \overline{z} \wedge dz = 2i dx \wedge dy,$
so we find that
$$\int_{\gamma} f dz = 2i \int_{\Delta} \partial_{\overline{z}} f dx \wedge dy,$$
where $dx \wedge dy$ is the usual area form.
If $f$ is holomorphic, then $\partial_{\overline{z}} f = 0,$ and so
this integral vanishes.  But if e.g. $f = \overline{z}$, then this
partial derivative equals $1$, so we are just computing $2i$ times the
area of $\Delta$.  (This is one way to get the answer of $i$ for the
line integral around a triangle I described above.)
A: We can write $f(z) = f(z_0) + f'(z_0)h + h \phi(h)$, with $h = (z - z_0)$ and  $\phi(h) \to 0$ as $h \to 0$ exactly when $f$ is holomorphic (that is, complex differentiable).
When $f$ is just $\mathbb R^2$ differentiable you get $f(z) = f(z_0) + \nabla f(z_0) \cdot (h_x,h_y) + \cdots$, which is not the same thing.
A: Remember that $f=u+iv$ is a $\Bbb C$-valued function and we are considering the line integral
$$\int_\gamma f(z)\,dz = \int_\gamma (u+iv)(dx+i\,dy)= \int_\gamma (u\,dx - v\,dy)+i(v\,dx+u\,dy).$$
When you get down to the linear approximation of a differentiable function $(u,v)\colon\Bbb R^2\to\Bbb R^2$, you will have something resembling
$$\int_\gamma \big((Ax + By) + i(Cx+Dy)\big)\, dx + i\big((Ax + By) + i(Cx+Dy)\big)\, dy\,,$$
which won't have a primitive (and hence won't have integral $0$) unless $B+iD=iA-C$. This looks a lot like the Cauchy-Riemann equations.
ADDED: Where did $B+iD=iA-C$ come from?  $\displaystyle\int_\gamma ax\,dx + by\,dy = 0$ for all $a,b$ and closed curves $\gamma$. This follows from Green's Theorem or from noticing that $F(x,y)=\frac12(ax^2+by^2)$ is a primitive. But what about $\displaystyle\int_\gamma ay\,dx + bx\,dy$? Again, Green's Theorem tells us that when $\gamma$ bounds a region $R$, this integral is $\displaystyle\iint_R (b-a)\,dxdy$. Thus, if we want this integral to be $0$ for all such $\gamma$, we need $a=b$. Alternatively, we can see that $a=b$ is necessary and sufficient for us to have a (smooth) function $F$ with $\displaystyle\frac{\partial F}{\partial x} = ay$ and $\displaystyle\frac{\partial F}{\partial y} = by$, inasmuch as $b=\displaystyle\frac{\partial^2 F}{\partial x\partial y} = \displaystyle\frac{\partial^2 F}{\partial y\partial x}=a$.
