To solve $dy/dx=g(y),$ we can instead solve $dx/dy=1/g(y).$ But, does this even work? In order to solve the DE $$\frac{dy}{dx}=g(y)$$ 
I always appeal to the fact that 
$$\frac{dy}{dx}=g(y) \Leftrightarrow \frac{dx}{dy}=\frac{1}{g(y)}.$$ 
But, is this even a fact?! I seem to recall that $$\left(\frac{dy}{dx}\right)^{-1} = \frac{dx}{dy}$$ only under certain circumstances, so that we lose generality by using this equivalence. If so, then how are we meant to obtain the most general solution to the original DE?
 A: This is a fact. What you are assuming is that $y$ is an invertible function of $x$. This assumption requires that $g(y)=\frac{dy(x)}{dx}\neq0$. Inverting this into a function $x$ of $y$ we get by the Inverse Function Theorem:
$\frac{dx(y)}{dy}=\frac{1}{\frac{dy(x)}{dx}}=\frac{1}{g(y)}$.
From here, as the comment section suggests, you simply integrate both sides to solve the differential equation:
$x=\int dx=\int\frac{dx}{dy}dy=\int \frac{1}{g(y)}dy$.
A: If $g$ is both continuous and non-vanishing, then no generality is lost.
To see this, assume that $g$ is a total function $\mathbb{R} \rightarrow \mathbb{R}$ that is indeed both continuous and non-vanishing. Then $g$ must be strictly positive everywhere, or else strictly negative everywhere.
In the first case, every solution $y$ to the equation $$\frac{dy}{dx}=g(y)$$ is strictly increasing hence injective. For every solution, by continuity, we have that $y(\mathbb{R})$ is an interval and since every $y$ is injective then we have a continuous inverse to each $y$ defined on the interval $y(\mathbb{R})$. For every solution $y$ we have $y$ is differentiable at each point $x\in\mathbb{R}$ with non-zero derivative so the inverse will be differentiable at $y(x)$ and will satisfy $\frac{dx}{dy}\vert_{y(x)}=\frac{1}{\big(\frac{dy}{dx}\vert_{x}\big)}$. But this implies that $$\left(\frac{dy}{dx}\right)^{-1} = \frac{dx}{dy}.$$ A similar argument can be in the second case.
So, at least if $g$ is continuous and non-vanishing (and defined on the entirety of $\mathbb{R}$), no generality is lost.
