Consider a compact surface $\mathcal{S} \subset \mathbb{R}^3$ without boundary and assume we are given the Gaussian curvature $K(x), x\in \mathcal{S}$. It is know that Gaussian curvature does not fully determine the Riemannian metric, as for example discussed in
Does the curvature determine the metric?Does the curvature determine the metric?
But for a given Gaussian curvature, does one have the freedom to choose a Riemannian metric such that the Gauss-Bonnet theorem holds?:
$$\int_{\mathcal{S}} K(x) d\mu_g(x) = 2\pi\; \chi(\mathcal{S}),$$
where $\mu_g$ is the Riemmanian volume measure induced by the metric $g$ and $\chi(\mathcal{S})$ is the Euler characteristic.
Is there even a constructive method for a Riemmanian metric $g$ under the conditions that the resulting Gaussian curvature is $K(x),x\in \mathcal{S}$ and the Gauss-Bonnet theorem is fulfilled?
(maybe this question is too general as stated above, but then might become more meaningful with assumptions on $K$.)