mirror of
https://github.com/cheat/cheat.git
synced 2025-09-03 10:38:29 +02:00
chore(deps): upgrade dependencies
Upgrade all dependencies to newest versions.
This commit is contained in:
8
vendor/github.com/go-git/go-billy/v5/memfs/memory.go
generated
vendored
8
vendor/github.com/go-git/go-billy/v5/memfs/memory.go
generated
vendored
@ -310,14 +310,14 @@ func (f *file) Duplicate(filename string, mode os.FileMode, flag int) billy.File
|
||||
flag: flag,
|
||||
}
|
||||
|
||||
if isAppend(flag) {
|
||||
new.position = int64(new.content.Len())
|
||||
}
|
||||
|
||||
if isTruncate(flag) {
|
||||
new.content.Truncate()
|
||||
}
|
||||
|
||||
if isAppend(flag) {
|
||||
new.position = int64(new.content.Len())
|
||||
}
|
||||
|
||||
return new
|
||||
}
|
||||
|
||||
|
11
vendor/github.com/go-git/go-billy/v5/memfs/storage.go
generated
vendored
11
vendor/github.com/go-git/go-billy/v5/memfs/storage.go
generated
vendored
@ -6,6 +6,7 @@ import (
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type storage struct {
|
||||
@ -174,6 +175,8 @@ func clean(path string) string {
|
||||
type content struct {
|
||||
name string
|
||||
bytes []byte
|
||||
|
||||
m sync.RWMutex
|
||||
}
|
||||
|
||||
func (c *content) WriteAt(p []byte, off int64) (int, error) {
|
||||
@ -185,6 +188,7 @@ func (c *content) WriteAt(p []byte, off int64) (int, error) {
|
||||
}
|
||||
}
|
||||
|
||||
c.m.Lock()
|
||||
prev := len(c.bytes)
|
||||
|
||||
diff := int(off) - prev
|
||||
@ -196,6 +200,7 @@ func (c *content) WriteAt(p []byte, off int64) (int, error) {
|
||||
if len(c.bytes) < prev {
|
||||
c.bytes = c.bytes[:prev]
|
||||
}
|
||||
c.m.Unlock()
|
||||
|
||||
return len(p), nil
|
||||
}
|
||||
@ -209,8 +214,10 @@ func (c *content) ReadAt(b []byte, off int64) (n int, err error) {
|
||||
}
|
||||
}
|
||||
|
||||
c.m.RLock()
|
||||
size := int64(len(c.bytes))
|
||||
if off >= size {
|
||||
c.m.RUnlock()
|
||||
return 0, io.EOF
|
||||
}
|
||||
|
||||
@ -220,10 +227,12 @@ func (c *content) ReadAt(b []byte, off int64) (n int, err error) {
|
||||
}
|
||||
|
||||
btr := c.bytes[off : off+l]
|
||||
n = copy(b, btr)
|
||||
|
||||
if len(btr) < len(b) {
|
||||
err = io.EOF
|
||||
}
|
||||
n = copy(b, btr)
|
||||
c.m.RUnlock()
|
||||
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user