use built in function

This commit is contained in:
cupcakearmy 2021-10-29 18:35:21 +02:00
parent efd4a7dfea
commit 6be0a80b29
No known key found for this signature in database
GPG Key ID: D28129AE5654D9D9
1 changed files with 5 additions and 8 deletions

View File

@ -157,16 +157,13 @@ func (l Location) Backup(cron bool, specificBackend string) []error {
if specificBackend == "" {
backends = l.To
} else {
for _, b := range l.To {
if b == specificBackend {
backends = []string{b}
goto backup
}
if l.hasBackend(specificBackend) {
backends = []string{specificBackend}
} else {
errors = append(errors, fmt.Errorf("backup location \"%s\" has no backend \"%s\"", l.name, specificBackend))
return errors
}
errors = append(errors, fmt.Errorf("backup location \"%s\" has no backend \"%s\"", l.name, specificBackend))
return errors
}
backup:
for i, to := range backends {
backend, _ := GetBackend(to)
colors.Secondary.Printf("Backend: %s\n", backend.name)