Skip to content

Commit

Permalink
Use slices.Concat where appropriate
Browse files Browse the repository at this point in the history
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
  • Loading branch information
mtrmac committed Sep 4, 2024
1 parent a3b2302 commit 9fce543
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion store.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"os"
"path/filepath"
"reflect"
"slices"
"strings"
"sync"
"syscall"
Expand Down Expand Up @@ -1622,7 +1623,7 @@ func (s *store) CreateImage(id string, names []string, layer, metadata string, i
Digest: dataDigest,
})
}
namesToAddAfterCreating = dedupeStrings(append(append([]string{}, i.Names...), names...))
namesToAddAfterCreating = dedupeStrings(slices.Concat(i.Names, names))
break
}
}
Expand Down
5 changes: 2 additions & 3 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package storage

import (
"fmt"
"slices"

"github.com/containers/storage/types"
)
Expand Down Expand Up @@ -54,9 +55,7 @@ func applyNameOperation(oldNames []string, opParameters []string, op updateNameO
}
}
case addNames:
result = make([]string, 0, len(opParameters)+len(oldNames))
result = append(result, opParameters...)
result = append(result, oldNames...)
result = slices.Concat(opParameters, oldNames)
default:
return result, errInvalidUpdateNameOperation
}
Expand Down

0 comments on commit 9fce543

Please sign in to comment.