Skip to content

Commit 388c586

Browse files
author
Peter Klaesson
committed
empty slice (initiated with []string) got serialized to null.
Changed to make([]string, 0) instead
1 parent 41009f3 commit 388c586

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

server/commands/Df.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func (command Command) Df() ([]string, error){
1414

1515
func df() ([]string, error) {
1616
settings := cfg.GetSettings()
17-
rootNames := []string{}
17+
rootNames := make([]string, 0)
1818
for i := 0; i < len(settings.Roots); i++ {
1919
rootNames = append(rootNames, settings.Roots[i].Name)
2020
}

server/commands/Ls.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func ls(directory string) ([]File, error) {
1919
}
2020

2121
files, _ := ioutil.ReadDir(path)
22-
var response []File
22+
response := make([]File, 0)
2323

2424
for _, file := range files {
2525
f := File{Name: file.Name(), Size: file.Size(), Modified: file.ModTime()}

0 commit comments

Comments
 (0)