here is how you do it. note that
Because of the pole of the new integrand at , we instead compute
now continue with the integration using a semi-circular contour in the upper half plane, based on the real axis.
with sum work, i suppose your second method could work. but you multiply by 1/x not x