Skip to content

Commit a6e312d

Browse files
committed
refactor(serverHandler): use non-pointer type of pathEntry
1 parent 8b85ccd commit a6e312d

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

src/serverHandler/json.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ type jsonItem struct {
1717
}
1818

1919
type jsonResponseData struct {
20-
NeedAuth bool `json:"needAuth"`
21-
AuthUserName string `json:"authUserName"`
22-
AuthSuccess bool `json:"authSuccess"`
23-
IsRoot bool `json:"isRoot"`
24-
Path string `json:"path"`
25-
Paths []*pathEntry `json:"paths"`
26-
SubItemPrefix string `json:"subItemPrefix"`
27-
ContextQueryString string `json:"contextQueryString"`
28-
CanUpload bool `json:"canUpload"`
29-
CanMkdir bool `json:"canMkdir"`
30-
CanDelete bool `json:"canDelete"`
31-
CanArchive bool `json:"canArchive"`
32-
CanCors bool `json:"canCors"`
20+
NeedAuth bool `json:"needAuth"`
21+
AuthUserName string `json:"authUserName"`
22+
AuthSuccess bool `json:"authSuccess"`
23+
IsRoot bool `json:"isRoot"`
24+
Path string `json:"path"`
25+
Paths []pathEntry `json:"paths"`
26+
SubItemPrefix string `json:"subItemPrefix"`
27+
ContextQueryString string `json:"contextQueryString"`
28+
CanUpload bool `json:"canUpload"`
29+
CanMkdir bool `json:"canMkdir"`
30+
CanDelete bool `json:"canDelete"`
31+
CanArchive bool `json:"canArchive"`
32+
CanCors bool `json:"canCors"`
3333

3434
Item *jsonItem `json:"item"`
3535
SubItems []*jsonItem `json:"subItems"`

src/serverHandler/responseData.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ type responseData struct {
5151

5252
IsRoot bool
5353
Path string
54-
Paths []*pathEntry
54+
Paths []pathEntry
5555
RootRelPath string
5656
File *os.File
5757
Item os.FileInfo
@@ -71,7 +71,7 @@ func isSlash(c rune) bool {
7171
return c == '/'
7272
}
7373

74-
func getPathEntries(path string, tailSlash bool) []*pathEntry {
74+
func getPathEntries(path string, tailSlash bool) []pathEntry {
7575
paths := []string{"/"}
7676
paths = append(paths, strings.FieldsFunc(path, isSlash)...)
7777

@@ -82,7 +82,7 @@ func getPathEntries(path string, tailSlash bool) []*pathEntry {
8282
pathsCount--
8383
}
8484

85-
pathEntries := make([]*pathEntry, displayPathsCount)
85+
pathEntries := make([]pathEntry, displayPathsCount)
8686
for i := 0; i < displayPathsCount; i++ {
8787
var rPath string
8888
switch {
@@ -94,7 +94,7 @@ func getPathEntries(path string, tailSlash bool) []*pathEntry {
9494
rPath = "./" + strings.Join(paths[pathsCount:], "/") + "/"
9595
}
9696

97-
pathEntries[i] = &pathEntry{
97+
pathEntries[i] = pathEntry{
9898
Name: paths[i],
9999
Path: rPath,
100100
}

0 commit comments

Comments
 (0)