INNER CODE UNIT · Go
pinPlatform
werf/nelm · scripts/denolock/main.go:150
func pinPlatform(ctx context.Context, client *resty.Client, version, platform string) (*platformResult, error) {
goos, _, _ := strings.Cut(platform, "/")
target := targets[platform]
archiveURL := denolock.ArchiveURLFor(version, target)
log.Default.Info(ctx, "Downloading %s", archiveURL)
archive, err := get(ctx, client, archiveURL)
if err != nil {
return nil, err
}
archiveSHA256 := sha256Hex(archive)
// Useless as a trust anchor, but it is the only thing that can tell an intact download from a
// broken one at the moment the digest is taken.
upstreamSHA256, err := fetchUpstreamChecksum(ctx, client, archiveURL)
if err != nil {