checkWritePermission checks if we can write to the directory.
(dir string)
| 228 | |
| 229 | // checkWritePermission checks if we can write to the directory. |
| 230 | func checkWritePermission(dir string) error { |
| 231 | tmp, err := os.CreateTemp(dir, ".chief-update-check-*") |
| 232 | if err != nil { |
| 233 | return err |
| 234 | } |
| 235 | tmp.Close() |
| 236 | os.Remove(tmp.Name()) |
| 237 | return nil |
| 238 | } |
| 239 | |
| 240 | // downloadToTemp downloads a URL to a temporary file in the specified directory. |
| 241 | func downloadToTemp(url, dir string) (string, error) { |