Solution (source code)

= Solution

Take upward <velocity> as positive. The linear <drag force> is $-mkv$, so it opposes the motion both during ascent and descent. <Newton's second law> gives $\dot v+kv=-g$. With $v(0)=u$, the <integrating factor> $e^{kt}$ yields
$$
\boxed{v(t)=\left(u+\frac gk\right)e^{-kt}-\frac gk,\qquad k>0.}
$$
The <terminal velocity> is $-g/k$. The limit $k\to0$ at fixed $t$ recovers $u-gt$; expanding the exponential is necessary to see the cancellation of the apparently singular terms.