Calculate:$\int _{|z|=1}\text{Re z dz}$. For a positively oriented unit  circle 

Calculate:$\int _{|z|=1}\text{Re z dz}$.

If $z=x+iy\implies \text{Re z}=x$
So $\int _{|z|=1}\text{Re z dz}=\int_{|z|=1} x d(x+iy)=\int _{|z|=1}x dx$.(as dy=0)
$=\frac{x^2}{2}|_0^{2\pi }=2\pi^2$
But the answer is not matching.It is given as $\pi i$.
Where am I wrong ?Please help.
 A: The issue with your approach is that $dy\neq 0$.
Instead, if you set $z=e^{it}$ for $0\leq t\leq 2\pi$, then $\Re z=\cos(t)$ and $\frac{dz}{dt}=ie^{it}$, hence
$$ \int_{|z|=1}\Re z\;dz=\int_0^{2\pi}\cos(t)ie^{it}\;dt=\int_0^{2\pi}[i\cos^2(t)-\cos(t)\sin(t)]\;dt $$
A: I thought it might be useful to present a "brute force way forward."  Proceeding, we have
$$\begin{align}
\oint_{|z|=1}\text{Re}(z)\,dz&=\color{blue}{\oint_{\sqrt{x^2+y^2}=1}x\,dx}+\color{red}{i\oint_{\sqrt{x^2+y^2}=1}x\,dy}\\\\
&=\color{blue}{\int_{1}^{-1} x\,dx+\int_{-1}^1x\,dx}+\color{red}{i\underbrace{\int_{-1}^1\sqrt{1-y^2}\,dy}_{=2\int_0^1\sqrt{1-y^2}\,dy}+i\underbrace{\int_1^{-1}\left(-\sqrt{1-y^2}\right)\,dy}_{=2\int_0^1\sqrt{1-y^2}\,dy}}\\\\
&=\color{blue}{0}+\color{red}{i4\underbrace{\int_0^1\sqrt{1-y^2}\,dy}_{=\pi/4\cdots\text{area of quarter circle}}}\\\\
&=i\pi
\end{align}$$
as expected.
A: On the unit circle $\gamma$ one has $\bar z={1\over z}$. It follows that
$$\int_\gamma {\rm Re}\,z\>dz={1\over2}\int_\gamma(z+\bar z)\>dz={1\over2}\int_\gamma z\>dz+{1\over2}\int_\gamma{1\over z}\>dz=0+{1\over2}2\pi i=\pi i\ .$$
