replace hand-written slice utilities with methods from slices package

SFTPGo depends on Go 1.22 so we can use slices package

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2024-07-24 18:17:55 +02:00
parent 6ba1198c47
commit bd5eb03d9c
4 changed files with 11 additions and 21 deletions

View File

@@ -809,15 +809,6 @@ func GetRedactedURL(rawurl string) string {
return u.Redacted()
}
// PrependFileInfo prepends a file info to a slice in an efficient way.
// We, optimistically, assume that the slice has enough capacity
func PrependFileInfo(files []os.FileInfo, info os.FileInfo) []os.FileInfo {
files = append(files, nil)
copy(files[1:], files)
files[0] = info
return files
}
// GetTLSVersion returns the TLS version for integer:
// - 12 means TLS 1.2
// - 13 means TLS 1.3