fix: return empty arrays instead of null in listPartitions, listVolumes, handleDiskVolumes
This commit is contained in:
+2
-2
@@ -82,7 +82,7 @@ func listPartitions(isoPath string) ([]string, error) {
|
||||
}
|
||||
|
||||
re := regexp.MustCompile(`^\s+([A-Z])\s+`)
|
||||
var parts []string
|
||||
parts := []string{}
|
||||
for _, line := range strings.Split(out, "\n") {
|
||||
if m := re.FindStringSubmatch(line); m != nil {
|
||||
parts = append(parts, m[1])
|
||||
@@ -110,7 +110,7 @@ func listVolumes(isoPath string, partitions []string) ([]volInfo, error) {
|
||||
rePrompt := regexp.MustCompile(`/disk0/([A-Z])\s*>`)
|
||||
reEntry := regexp.MustCompile(`^\s+\d+\s+(.+?)\s+-\s+`)
|
||||
|
||||
var vols []volInfo
|
||||
vols := []volInfo{}
|
||||
currentPart := ""
|
||||
|
||||
for _, line := range strings.Split(out, "\n") {
|
||||
|
||||
Reference in New Issue
Block a user