This is the exercise 13 on page 358 of Analysis II of Amann and Escher
Let $L:=a+\Bbb R b$, for some $a,b\in\Bbb C$, a straight line in $\Bbb C$. Also let $f\in C(U,\Bbb C)$ is holomorphic on $U\setminus L$. Show that $f$ is holomorphic on all of $U$. (Hint: Morera's theorem.)
I opened the question because I think the exercise is wrong, that is, $f$ is not necessarily holomorphic on $U$.
I have a counterexample: let
$$f:\Bbb C\to\Bbb C,\quad z\mapsto\begin{cases}e^{-1/z}, &z\neq 0\\0, &z=0\end{cases}$$
Then $f$ is continuous and clearly analytic in $\Bbb C\setminus\{0\}$. However it is not analytic on the zero because $f^{(k)}(0)=0$ for all $k\in\Bbb N$. Hence choosing any $L$ that pass by zero give a counterexample to what the exercise want to be proved.
Questions:
Is my counterexample correct or there is something that I had overlooked?
If my counterexample is correct, there is some assumption that we can add to the exercise to make it correct?
EDIT:
Ah!, there is a mistake with my counterexample. The function $f$ is not continuous at zero. Observe that
$$\lim_{r\to\infty} e^{-ir}\neq 0$$
Thus probably I need to think more and solve the exercise ^^