Show that $\mathrm{E}[g(X)]=g(0)+\int_{0}^{\infty }g'(x)P(X>x) \mathop{}\!d x$
In terms of the CDF $F$,$$\begin{align}E[g(X)]-\int_0^\infty g^\prime(x)P(X>x)dx&=\int_0^\infty[g(x)dF^\prime(x)-g^\prime(x)(1-F(x))dx]\\&=\color{red}{[g(x)F(x)]_0^\infty}-\color{blue}{\int_0^\infty g^\prime(x)dx}\\&=\color{red}{\lim_{x\to\infty}g(x)}-\left(\color{blue}{\lim_{x\to\infty}g(x)-g(0)}\right)\\&=g(0).\end{align}$$Your approach can be made to work too, but since $g(0)$ may be positive, your first step should have read$$E[g(X)]=g(0)+\int_{g(0)}^\infty P(g(X)>x)dx.$$(You can see this, for example, by writing $g(x)=g(0)+g_0(x)$.)