$f$ is analytic on $D$, prove that $f$ is a constant I've been stuck on this for a while, it is a decade old qualifying exam problem from my university:
Let $f$ be a analytic function in the open unit disk $D$ such that $|f(z)|\leq 1$ for all $z\in D$. Let $g$ be the restriction of $f$ to the real interval $(0,1)$ and assume $\lim_{r\rightarrow 1}g(r)=1$ and $\lim_{r\rightarrow 1}g'(r)=0$. Prove that $f$ is a constant.
Can anyone please give me some hints? I've really tried everything now, but nothing seems to work. The condition given seems to be very localized and I'm not sure how to use them. Thanks in advance!

Here is another idea. The intuition is this. We modify $f$ so that $f(0) = 0$ so we can apply Schwarz lemma. Then we want to "Taylor" expand at $z = 1$.
Assume $f$ isn't constant. Let $f_1 = \psi \circ f$ where $\psi$ is the conformal map chosen so $\psi(1) = 1$ and $\psi(f(0)) = 0$.
We can take $$ \psi(z) = w \frac{z - f(0)}{1 - \overline{f(0)} z}  $$ where $w$ is in the unit circle so $\psi(1) = 1$.
Let $h(r) = f_1(r)$ if $r \in (0,1)$ and $h(r) = 1$ else. Also $h'(r) = \psi'(f(r))f'(r)$ so $h$ is continuously differentiable and $h'(1) = 0$ and $h(1) = 1$. We need here that $|f(0)| < 1$.
Since $f$ isn't constant, by Schwarz lemma $|{h(r)}| < r$ for $r < 1$.
Now $\left| \frac{h(1-\epsilon) - h(1)}{-\epsilon} \right| < \frac 12 $ if $\epsilon$ is small. Hence $|h(1-\epsilon)| \geq 1 - \frac 12 \epsilon \geq 1-\epsilon$.
