Check reports whether the local binary's sha256 differs from the remote asset's recorded hash. ctx propagates a startup Ctrl+C into the HTTP request. Returns false on any failure; see package doc.
(ctx context.Context, execPath string)
| 54 | remote, err := fetchHash(ctx, asset) |
| 55 | if err != nil || remote == "" { |
| 56 | return false |
| 57 | } |
| 58 | return !strings.EqualFold(local, remote) |
| 59 | } |
| 60 | |
| 61 | // assetName mirrors the name_template in .goreleaser.yaml. Every goos goreleaser |
| 62 | // builds for must have a case here; a missing one silently locks that |
| 63 | // platform's users out of auto updates (the Windows regression); |
| 64 | // TestAssetNameCoversEveryReleasedPlatform pins the contract. |
| 65 | // |
| 66 | // Unsupported platforms (freebsd, plan9, linux/386, …) return ok=false so Check |
| 67 | // short circuits before touching the network. |
| 68 | func assetName(goos, goarch string) (string, bool) { |
| 69 | ext := "" |
| 70 | switch goos { |
| 71 | case "linux": |
| 72 | // keep as is |
| 73 | case "darwin": |
| 74 | goos = "macos" |
| 75 | case "windows": |
| 76 | // Manifest row reads `<hash> codehamr-windows-<arch>.exe`; match the |