go fmt ./...

This commit is contained in:
cuu
2021-10-11 13:55:54 +08:00
parent 0fe6399441
commit 7382cc40b1
88 changed files with 10028 additions and 10478 deletions

View File

@@ -1,46 +1,45 @@
package UI
import (
"sync"
"sync"
)
type FolderStack struct {
lock *sync.Mutex
head *element
Size int
RootPath string
lock *sync.Mutex
head *element
Size int
RootPath string
}
func (stk *FolderStack) Push(data interface{}) {
stk.lock.Lock()
stk.lock.Lock()
element := new(element)
element.data = data
temp := stk.head
element.next = temp
stk.head = element
stk.Size++
element := new(element)
element.data = data
temp := stk.head
element.next = temp
stk.head = element
stk.Size++
stk.lock.Unlock()
stk.lock.Unlock()
}
func (stk *FolderStack) Pop() interface{} {
if stk.head == nil {
return nil
}
stk.lock.Lock()
r := stk.head.data
stk.head = stk.head.next
stk.Size--
if stk.head == nil {
return nil
}
stk.lock.Lock()
r := stk.head.data
stk.head = stk.head.next
stk.Size--
stk.lock.Unlock()
stk.lock.Unlock()
return r
return r
}
func (stk *FolderStack) SetRootPath(path string) {
stk.RootPath = path
stk.RootPath = path
}
func (stk *FolderStack) Length() int {
@@ -48,16 +47,16 @@ func (stk *FolderStack) Length() int {
}
func (stk *FolderStack) Last() string {
idx := stk.Length() -1
if idx < 0 {
return stk.RootPath
}else {
return stk.head.data.(string)
}
idx := stk.Length() - 1
if idx < 0 {
return stk.RootPath
} else {
return stk.head.data.(string)
}
}
func NewFolderStack() *FolderStack {
stk := new(FolderStack)
stk.lock = &sync.Mutex{}
return stk
stk := new(FolderStack)
stk.lock = &sync.Mutex{}
return stk
}