func checkZigMirrored()

in tools/releaser/main.go [464:490]


func checkZigMirrored(repoRoot string) error {
	upstream, err := parseZigUpstream(path.Join(repoRoot, "toolchain", "private", "zig_sdk.bzl"))
	if err != nil {
		return err
	}

	// spot-checking only windows-x86_64, because:
	// - to check all platforms, we should parse much more of zig_sdk.bzl.
	// - so we'd rather pick a single platform and test it.
	// - because windows coverage is smallest, let's take the windows platform.
	url := strings.Replace(upstream.urlTemplate, "{host_platform}", "windows-x86_64", 1)
	url = strings.ReplaceAll(url, "{version}", upstream.version)
	url = strings.Replace(url, "{_ext}", "zip", 1)

	log("checking if zig is mirorred in %q", url)

	resp, err := http.Head(url)
	if err != nil {
		return err
	}

	if resp.StatusCode != 200 {
		return fmt.Errorf("got non-200: %s", resp.Status)
	}

	return nil
}