assetName mirrors the name_template in .goreleaser.yaml. Every goos goreleaser builds for must have a case here; a missing one silently locks that platform's users out of auto-updates (the Windows regression); TestAssetNameCoversEveryReleasedPlatform pins the contract. Unsupported platforms (freebs
(goos, goarch string)
| 80 | // Unsupported platforms (freebsd, plan9, linux/386, …) return ok=false so Check |
| 81 | // short-circuits before touching the network. |
| 82 | func assetName(goos, goarch string) (string, bool) { |
| 83 | ext := "" |
| 84 | switch goos { |
| 85 | case "linux": |
| 86 | // keep as-is |
| 87 | case "darwin": |
| 88 | goos = "macos" |
| 89 | case "windows": |
| 90 | // Manifest row reads `<hash> codehamr-windows-<arch>.exe`; match the |
| 91 | // .exe or the asset 404s on download. |
| 92 | ext = ".exe" |
| 93 | default: |
| 94 | return "", false |
| 95 | } |
| 96 | if goarch != "amd64" && goarch != "arm64" { |
| 97 | return "", false |
| 98 | } |
| 99 | return fmt.Sprintf("codehamr-%s-%s%s", goos, goarch, ext), true |
| 100 | } |
| 101 | |
| 102 | // hashFile streams a file through sha256. |
| 103 | func hashFile(path string) (string, error) { |
no outgoing calls