Answer
$$y= \frac{1}{\sec x }\left( x +C\right).$$
Work Step by Step
This is a linear equation which has the integrating factor as follows
$$\alpha(x)= e^{\int P(x)dx}=e^{ \int \tan x dx}=e^{-\ln(\cos x)}=\sec x$$
where we used the fact that $ \int \tan xdx=-\ln(\cos x)$.
Now the general solution is
\begin{align}
y&=\alpha^{-1}(x)\left( \int\alpha(x) Q(x)dx +C\right)\\ &=\frac{1}{\sec x }\left( \int \sec x \cos xdx +C\right)\\ &= \frac{1}{\sec x }\left( \int dx +C\right)\\
&= \frac{1}{\sec x }\left( x +C\right)\\ \end{align}
Thus, the general solution is
$$y= \frac{1}{\sec x }\left( x +C\right).$$