From 6be0a80b29ed8d69463532b7603eca63b7b6fe2b Mon Sep 17 00:00:00 2001 From: cupcakearmy Date: Fri, 29 Oct 2021 18:35:21 +0200 Subject: [PATCH] use built in function --- internal/location.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/internal/location.go b/internal/location.go index 7881e72..cf75ce1 100644 --- a/internal/location.go +++ b/internal/location.go @@ -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)