1
0
mirror of https://github.com/offen/docker-volume-backup.git synced 2025-11-29 05:46:50 +02:00

Use go 1.20, join errors using stdlib (#182)

* Use go 1.20, join errors using stdlib

* Use go 1.20 proper
This commit is contained in:
Frederik Ring
2023-02-02 21:07:25 +01:00
committed by GitHub
parent 1e36bd3eb7
commit 2d37e08743
8 changed files with 16 additions and 42 deletions

View File

@@ -6,6 +6,7 @@ package azure
import (
"bytes"
"context"
"errors"
"fmt"
"os"
"path/filepath"
@@ -18,7 +19,6 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/container"
"github.com/offen/docker-volume-backup/internal/storage"
"github.com/offen/docker-volume-backup/internal/utilities"
)
type azureBlobStorage struct {
@@ -135,21 +135,21 @@ func (b *azureBlobStorage) Prune(deadline time.Time, pruningPrefix string) (*sto
if err := b.DoPrune(b.Name(), len(matches), int(totalCount), "Azure Blob Storage backup(s)", func() error {
wg := sync.WaitGroup{}
wg.Add(len(matches))
var errors []error
var errs []error
for _, match := range matches {
name := match
go func() {
_, err := b.client.DeleteBlob(context.Background(), b.containerName, name, nil)
if err != nil {
errors = append(errors, err)
errs = append(errs, err)
}
wg.Done()
}()
}
wg.Wait()
if len(errors) != 0 {
return utilities.Join(errors...)
if len(errs) != 0 {
return errors.Join(errs...)
}
return nil
}); err != nil {