I'm trying to resolve an apparent contradiction and have yet to find my mistake. The goal is to calculate
$$ I = \int_{\Gamma_R} \frac{1/(w-1)^2}{w-z} dw $$
where $z \in \mathbb{C}$ is fixed and $\Gamma_R$ is a circle of radius $R$ centered at $1$. Take $R$ to be arbitrarily large. Then the integral is the sum of the poles of the integrand, which is just the pole at $z$ since the pole at $1$ is second order with zero residue. From this approach I find
$$ I = \frac{2\pi i}{(z-1)^2} $$
On the other hand, it's immediately clear that the integrand goes as $R^{-3}$ while the length of the contour goes as $R$, so that as $R\rightarrow\infty$, $I\rightarrow 0$. From this approach
$$ I = 0 $$
Obviously I have overlooked something. Can anyone help me track down my error?
The residue formula at a pole of order $2$ for some analytic $f$ at some point $y$ is $lim_{w \to y}((w-y)^2f(w))'$
So here $f(w)=\frac{1/(w-1)^2}{w-z}, y=1$ and we assume for simplicity $z \ne 1$
Then $g(w)=(w-1)^2f(w)=\frac{1}{w-z}$, so $g'(1)=-\frac{1}{(1-z)^2}$ hence there is a residue at $1$ and it cancels the residue at $z$, so no contradiction as the integral is indeed $0$