forked from forgejo/forgejo
go1.16 (#14783)
This commit is contained in:
parent
030646eea4
commit
47f6a4ec3f
947 changed files with 26119 additions and 7062 deletions
19
vendor/github.com/spf13/afero/mem/file.go
generated
vendored
19
vendor/github.com/spf13/afero/mem/file.go
generated
vendored
|
@ -22,10 +22,9 @@ import (
|
|||
"path/filepath"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
)
|
||||
|
||||
import "time"
|
||||
|
||||
const FilePathSeparator = string(filepath.Separator)
|
||||
|
||||
type File struct {
|
||||
|
@ -57,6 +56,8 @@ type FileData struct {
|
|||
dir bool
|
||||
mode os.FileMode
|
||||
modtime time.Time
|
||||
uid int
|
||||
gid int
|
||||
}
|
||||
|
||||
func (d *FileData) Name() string {
|
||||
|
@ -95,6 +96,18 @@ func setModTime(f *FileData, mtime time.Time) {
|
|||
f.modtime = mtime
|
||||
}
|
||||
|
||||
func SetUID(f *FileData, uid int) {
|
||||
f.Lock()
|
||||
f.uid = uid
|
||||
f.Unlock()
|
||||
}
|
||||
|
||||
func SetGID(f *FileData, gid int) {
|
||||
f.Lock()
|
||||
f.gid = gid
|
||||
f.Unlock()
|
||||
}
|
||||
|
||||
func GetFileInfo(f *FileData) *FileInfo {
|
||||
return &FileInfo{f}
|
||||
}
|
||||
|
@ -210,6 +223,8 @@ func (f *File) Truncate(size int64) error {
|
|||
if size < 0 {
|
||||
return ErrOutOfRange
|
||||
}
|
||||
f.fileData.Lock()
|
||||
defer f.fileData.Unlock()
|
||||
if size > int64(len(f.fileData.data)) {
|
||||
diff := size - int64(len(f.fileData.data))
|
||||
f.fileData.data = append(f.fileData.data, bytes.Repeat([]byte{00}, int(diff))...)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue