(homePaths aghconfig.HomePaths)
| 214 | } |
| 215 | |
| 216 | func removeRuntimeArtifacts(homePaths aghconfig.HomePaths) ([]string, error) { |
| 217 | candidates := []string{ |
| 218 | homePaths.DaemonSocket, |
| 219 | homePaths.DaemonLock, |
| 220 | homePaths.DaemonInfo, |
| 221 | } |
| 222 | removed := make([]string, 0, len(candidates)) |
| 223 | for _, path := range candidates { |
| 224 | deleted, err := removeFileIfExists(path) |
| 225 | if err != nil { |
| 226 | return nil, err |
| 227 | } |
| 228 | if deleted { |
| 229 | removed = append(removed, path) |
| 230 | } |
| 231 | } |
| 232 | return removed, nil |
| 233 | } |
| 234 | |
| 235 | func removeFileIfExists(path string) (bool, error) { |
| 236 | trimmed := strings.TrimSpace(path) |
no test coverage detected