Suppose $M(x,y)$ and $N(x,y)$ are $\mathcal{C}^1$ functions on some open set in the plane. Suppose also that we have $M(x,y) dx + N(x,y) dy = 0, f_x(x,y) = M(x,y)$ and $M_y = N_x$. The author shows that $f_y(x,y) = N$ in the following manner:
$$f_x(x,y) = M(x,y) \Rightarrow f(x,y) = \int M(x,y)\ dx + g(y) \Rightarrow f_y(x,y) = \frac{\partial}{\partial y} \int M(x,y) \ dx + g'(y) = N(x,y)$$
I am confused by the last equality. By the Leibniz integral rule we have:
$$\frac{\partial}{\partial y} \int M(x,y) \ dx + g'(y) = \int N_x(x,y) \ dx + g'(y) = N(x,y)+ (h(x) + g'(y))$$
My question is, how does the $g'(y)$ term vanish? I'm guessing that I'm looking over some chain rule fact, but I'm not seeing it right now.