def METHOD_NAME(self, path=None, goos=None, goarch=None, cgo_enabled=False):
    nexus_path = self._get_wheel_nexus_path(path=path, goos=goos, goarch=goarch)
    src_dir = Path(__file__).parent
    env = {}
    if goos:
        env["GOOS"] = goos
    if goarch:
        env["GOARCH"] = goarch
    # cgo is needed on:
    #  - arm macs to build the gopsutil dependency,
    #    otherwise several system metrics will be unavailable.
    #  - linux to build the dependencies needed to get GPU metrics.
    env["CGO_ENABLED"] = "1" if cgo_enabled else "0"
    # todo: temporary hack to get the build working on linux for the darwin-arm64 wheel
    if goos == "darwin" and goarch == "arm64" and platform.system() == "Linux":
        env["CGO_ENABLED"] = "0"
    os.makedirs(nexus_path.parent, exist_ok=True)
    # Sentry only allows 12 characters for release names, the full commit hash won't fit
    commit = (
        subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=src_dir)
        .decode("utf-8")
        .strip()
    )
    # build linux binary with docker on mac
    if goos == "linux" and platform.system() != "Linux":
        # build docker image
        cmd = (
            "docker",
            "build",
            "-t",
            "wheel_builder",
            "--platform",
            f"linux/{goarch}",
            ".",
        )
        subprocess.check_call(
            cmd,
            cwd=src_dir / "scripts" / "build",
            env=dict(os.environ, **env),
        )
        # build wheels
        cmd = (
            "docker",
            "run",
            "--rm",
            "--platform",
            f"linux/{goarch}",
            "-v",
            f"{src_dir.parent}:/project",
            "-v",
            f"{src_dir.parent}/.cache/go-build:/root/.cache/go-build",
            "-e",
            f"COMMIT={commit}",
            "-e",
            f"NEXUS_PATH={str(nexus_path.relative_to(src_dir))}",
            "-e",
            f"CGO_ENABLED={env['CGO_ENABLED']}",
            "wheel_builder",
        )
        log.info(f"Building wheel for {goos}-{goarch}")
        log.info(f"Running command: {' '.join(cmd)}")
        subprocess.check_call(
            cmd,
            cwd=src_dir.parent,
            env=dict(os.environ, **env),
        )
    else:
        ldflags = f"-s -w -X main.commit={commit}"
        cmd = (
            "go",
            "build",
            f"-ldflags={ldflags}",
            "-o",
            str(nexus_path),
            "cmd/nexus/main.go",
        )
        log.info(f"Building wheel for {goos}-{goarch}")
        log.info(f"Running command: {' '.join(cmd)}")
        subprocess.check_call(cmd, cwd=src_dir, env=dict(os.environ, **env))