MCPcopy Create free account
hub / github.com/MiniCodeMonkey/chief / findAssets

Function findAssets

internal/update/update.go:213–227  ·  view source on GitHub ↗

findAssets locates the binary and checksum assets for the given OS/arch.

(assets []Asset, goos, goarch string)

Source from the content-addressed store, hash-verified

211
212// findAssets locates the binary and checksum assets for the given OS/arch.
213func findAssets(assets []Asset, goos, goarch string) (*Asset, *Asset) {
214 binaryName := fmt.Sprintf("chief-%s-%s", goos, goarch)
215 checksumName := binaryName + ".sha256"
216
217 var binary, checksum *Asset
218 for i := range assets {
219 if assets[i].Name == binaryName {
220 binary = &assets[i]
221 }
222 if assets[i].Name == checksumName {
223 checksum = &assets[i]
224 }
225 }
226 return binary, checksum
227}
228
229// checkWritePermission checks if we can write to the directory.
230func checkWritePermission(dir string) error {

Callers 4

PerformUpdateFunction · 0.85
TestFindAssetsFunction · 0.85
TestFindAssets_NoMatchFunction · 0.85

Calls

no outgoing calls

Tested by 3

TestFindAssetsFunction · 0.68
TestFindAssets_NoMatchFunction · 0.68