Mathematica gives
$$g(a)=\frac{\pi}{2} \,  \text{sgn}(a) \ln(\left| a\right| +1)
$$
for real $a$. 

This can be obtained as follows:
$$g'(a)=\int_0^{\pi/2}\frac{dx}{1+a^2\tan^2 x}=\int_0^\infty\frac{dx}{(1+a^2u^2)(1+u^2)},
$$
and the latter integral can be taken by partial fraction decomposition.