findAssets locates the binary and checksum assets for the given OS/arch.
(assets []Asset, goos, goarch string)
| 211 | |
| 212 | // findAssets locates the binary and checksum assets for the given OS/arch. |
| 213 | func 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. |
| 230 | func checkWritePermission(dir string) error { |
no outgoing calls