MCPcopy Index your code
hub / github.com/codehamr/codehamr / assetName

Function assetName

internal/update/update.go:82–100  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

80// Unsupported platforms (freebsd, plan9, linux/386, …) return ok=false so Check
81// short-circuits before touching the network.
82func 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.
103func hashFile(path string) (string, error) {

Callers 6

assetNameSupportedFunction · 0.85
CheckFunction · 0.85
ApplyFunction · 0.85
platformAssetFunction · 0.85

Calls

no outgoing calls

Tested by 4

assetNameSupportedFunction · 0.68
platformAssetFunction · 0.68