Skip to content

Commit ab06aeb

Browse files
committed
internal/volumespec: fix prealloc linting
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 9a0c78f commit ab06aeb

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

internal/volumespec/volumespec.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func Parse(spec string) (VolumeConfig, error) {
2525
return volume, nil
2626
}
2727

28-
var buffer []rune
28+
buffer := make([]rune, 0, len(spec))
2929
for _, char := range spec + string(endOfSpec) {
3030
switch {
3131
case isWindowsDrive(buffer, char):
@@ -35,7 +35,7 @@ func Parse(spec string) (VolumeConfig, error) {
3535
populateType(&volume)
3636
return volume, fmt.Errorf("invalid spec: %s: %w", spec, err)
3737
}
38-
buffer = []rune{}
38+
buffer = buffer[:0] // reset, but reuse capacity
3939
default:
4040
buffer = append(buffer, char)
4141
}

0 commit comments

Comments
 (0)