1
0
mirror of https://github.com/gogf/gf.git synced 2025-04-05 11:18:50 +08:00

fix typo flie -> file (#3228)

This commit is contained in:
John Guo 2024-01-02 20:17:54 +08:00 committed by GitHub
parent 6abd8bd864
commit 1e21b61a19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 40 additions and 40 deletions

View File

@ -16,7 +16,7 @@ import (
func ExampleGetContentsWithCache() {
// init
var (
fileName = "gflie_example.txt"
fileName = "gfile_example.txt"
tempDir = gfile.Temp("gfile_example_cache")
tempFile = gfile.Join(tempDir, fileName)
)

View File

@ -15,7 +15,7 @@ import (
func ExampleGetContents() {
// init
var (
fileName = "gflie_example.txt"
fileName = "gfile_example.txt"
tempDir = gfile.Temp("gfile_example_content")
tempFile = gfile.Join(tempDir, fileName)
)
@ -34,7 +34,7 @@ func ExampleGetContents() {
func ExampleGetBytes() {
// init
var (
fileName = "gflie_example.txt"
fileName = "gfile_example.txt"
tempDir = gfile.Temp("gfile_example_content")
tempFile = gfile.Join(tempDir, fileName)
)
@ -53,7 +53,7 @@ func ExampleGetBytes() {
func ExamplePutContents() {
// init
var (
fileName = "gflie_example.txt"
fileName = "gfile_example.txt"
tempDir = gfile.Temp("gfile_example_content")
tempFile = gfile.Join(tempDir, fileName)
)
@ -72,7 +72,7 @@ func ExamplePutContents() {
func ExamplePutBytes() {
// init
var (
fileName = "gflie_example.txt"
fileName = "gfile_example.txt"
tempDir = gfile.Temp("gfile_example_content")
tempFile = gfile.Join(tempDir, fileName)
)
@ -90,7 +90,7 @@ func ExamplePutBytes() {
func ExamplePutContentsAppend() {
// init
var (
fileName = "gflie_example.txt"
fileName = "gfile_example.txt"
tempDir = gfile.Temp("gfile_example_content")
tempFile = gfile.Join(tempDir, fileName)
)
@ -116,7 +116,7 @@ func ExamplePutContentsAppend() {
func ExamplePutBytesAppend() {
// init
var (
fileName = "gflie_example.txt"
fileName = "gfile_example.txt"
tempDir = gfile.Temp("gfile_example_content")
tempFile = gfile.Join(tempDir, fileName)
)
@ -141,7 +141,7 @@ func ExamplePutBytesAppend() {
func ExampleGetNextCharOffsetByPath() {
// init
var (
fileName = "gflie_example.txt"
fileName = "gfile_example.txt"
tempDir = gfile.Temp("gfile_example_content")
tempFile = gfile.Join(tempDir, fileName)
)
@ -160,7 +160,7 @@ func ExampleGetNextCharOffsetByPath() {
func ExampleGetBytesTilCharByPath() {
// init
var (
fileName = "gflie_example.txt"
fileName = "gfile_example.txt"
tempDir = gfile.Temp("gfile_example_content")
tempFile = gfile.Join(tempDir, fileName)
)
@ -178,7 +178,7 @@ func ExampleGetBytesTilCharByPath() {
func ExampleGetBytesByTwoOffsetsByPath() {
// init
var (
fileName = "gflie_example.txt"
fileName = "gfile_example.txt"
tempDir = gfile.Temp("gfile_example_content")
tempFile = gfile.Join(tempDir, fileName)
)
@ -196,7 +196,7 @@ func ExampleGetBytesByTwoOffsetsByPath() {
func ExampleReadLines() {
// init
var (
fileName = "gflie_example.txt"
fileName = "gfile_example.txt"
tempDir = gfile.Temp("gfile_example_content")
tempFile = gfile.Join(tempDir, fileName)
)
@ -219,7 +219,7 @@ func ExampleReadLines() {
func ExampleReadLinesBytes() {
// init
var (
fileName = "gflie_example.txt"
fileName = "gfile_example.txt"
tempDir = gfile.Temp("gfile_example_content")
tempFile = gfile.Join(tempDir, fileName)
)

View File

@ -15,12 +15,12 @@ import (
func ExampleCopy() {
// init
var (
srcFileName = "gflie_example.txt"
srcFileName = "gfile_example.txt"
srcTempDir = gfile.Temp("gfile_example_copy_src")
srcTempFile = gfile.Join(srcTempDir, srcFileName)
// copy file
dstFileName = "gflie_example_copy.txt"
dstFileName = "gfile_example_copy.txt"
dstTempFile = gfile.Join(srcTempDir, dstFileName)
// copy dir
@ -47,6 +47,6 @@ func ExampleCopy() {
// Output:
// goframe example copy
// gflie_example.txt
// gflie_example_copy.txt
// gfile_example.txt
// gfile_example_copy.txt
}

View File

@ -16,7 +16,7 @@ import (
func ExampleReplaceFile() {
// init
var (
fileName = "gflie_example.txt"
fileName = "gfile_example.txt"
tempDir = gfile.Temp("gfile_example_replace")
tempFile = gfile.Join(tempDir, fileName)
)
@ -40,7 +40,7 @@ func ExampleReplaceFile() {
func ExampleReplaceFileFunc() {
// init
var (
fileName = "gflie_example.txt"
fileName = "gfile_example.txt"
tempDir = gfile.Temp("gfile_example_replace")
tempFile = gfile.Join(tempDir, fileName)
)
@ -68,7 +68,7 @@ func ExampleReplaceFileFunc() {
func ExampleReplaceDir() {
// init
var (
fileName = "gflie_example.txt"
fileName = "gfile_example.txt"
tempDir = gfile.Temp("gfile_example_replace")
tempFile = gfile.Join(tempDir, fileName)
)
@ -80,7 +80,7 @@ func ExampleReplaceDir() {
fmt.Println(gfile.GetContents(tempFile))
// It replaces content of all files under specified directory recursively.
gfile.ReplaceDir("content", "replace word", tempDir, "gflie_example.txt", true)
gfile.ReplaceDir("content", "replace word", tempDir, "gfile_example.txt", true)
// read contents
fmt.Println(gfile.GetContents(tempFile))
@ -93,7 +93,7 @@ func ExampleReplaceDir() {
func ExampleReplaceDirFunc() {
// init
var (
fileName = "gflie_example.txt"
fileName = "gfile_example.txt"
tempDir = gfile.Temp("gfile_example_replace")
tempFile = gfile.Join(tempDir, fileName)
)
@ -109,7 +109,7 @@ func ExampleReplaceDirFunc() {
// Replace with regular match
reg, _ := regexp.Compile(`\d{3}`)
return reg.ReplaceAllString(content, "[num]")
}, tempDir, "gflie_example.txt", true)
}, tempDir, "gfile_example.txt", true)
fmt.Println(gfile.GetContents(tempFile))

View File

@ -15,7 +15,7 @@ import (
func ExampleScanDir() {
// init
var (
fileName = "gflie_example.txt"
fileName = "gfile_example.txt"
tempDir = gfile.Temp("gfile_example_scan_dir")
tempFile = gfile.Join(tempDir, fileName)
@ -34,15 +34,15 @@ func ExampleScanDir() {
}
// Output:
// gflie_example.txt
// gfile_example.txt
// sub_dir
// gflie_example.txt
// gfile_example.txt
}
func ExampleScanDirFile() {
// init
var (
fileName = "gflie_example.txt"
fileName = "gfile_example.txt"
tempDir = gfile.Temp("gfile_example_scan_dir_file")
tempFile = gfile.Join(tempDir, fileName)
@ -61,14 +61,14 @@ func ExampleScanDirFile() {
}
// Output:
// gflie_example.txt
// gflie_example.txt
// gfile_example.txt
// gfile_example.txt
}
func ExampleScanDirFunc() {
// init
var (
fileName = "gflie_example.txt"
fileName = "gfile_example.txt"
tempDir = gfile.Temp("gfile_example_scan_dir_func")
tempFile = gfile.Join(tempDir, fileName)
@ -83,7 +83,7 @@ func ExampleScanDirFunc() {
// scans directory recursively
list, _ := gfile.ScanDirFunc(tempDir, "*", true, func(path string) string {
// ignores some files
if gfile.Basename(path) == "gflie_example.txt" {
if gfile.Basename(path) == "gfile_example.txt" {
return ""
}
return path
@ -99,11 +99,11 @@ func ExampleScanDirFunc() {
func ExampleScanDirFileFunc() {
// init
var (
fileName = "gflie_example.txt"
fileName = "gfile_example.txt"
tempDir = gfile.Temp("gfile_example_scan_dir_file_func")
tempFile = gfile.Join(tempDir, fileName)
fileName1 = "gflie_example_ignores.txt"
fileName1 = "gfile_example_ignores.txt"
tempFile1 = gfile.Join(tempDir, fileName1)
tempSubDir = gfile.Join(tempDir, "sub_dir")
@ -118,7 +118,7 @@ func ExampleScanDirFileFunc() {
// scans directory recursively exclusive of directories
list, _ := gfile.ScanDirFileFunc(tempDir, "*.txt", true, func(path string) string {
// ignores some files
if gfile.Basename(path) == "gflie_example_ignores.txt" {
if gfile.Basename(path) == "gfile_example_ignores.txt" {
return ""
}
return path
@ -128,6 +128,6 @@ func ExampleScanDirFileFunc() {
}
// Output:
// gflie_example.txt
// gflie_example.txt
// gfile_example.txt
// gfile_example.txt
}

View File

@ -15,7 +15,7 @@ import (
func ExampleSearch() {
// init
var (
fileName = "gflie_example.txt"
fileName = "gfile_example.txt"
tempDir = gfile.Temp("gfile_example_search")
tempFile = gfile.Join(tempDir, fileName)
)
@ -28,5 +28,5 @@ func ExampleSearch() {
fmt.Println(gfile.Basename(realPath))
// Output:
// gflie_example.txt
// gfile_example.txt
}

View File

@ -15,7 +15,7 @@ import (
func ExampleSize() {
// init
var (
fileName = "gflie_example.txt"
fileName = "gfile_example.txt"
tempDir = gfile.Temp("gfile_example_size")
tempFile = gfile.Join(tempDir, fileName)
)
@ -31,7 +31,7 @@ func ExampleSize() {
func ExampleSizeFormat() {
// init
var (
fileName = "gflie_example.txt"
fileName = "gfile_example.txt"
tempDir = gfile.Temp("gfile_example_size")
tempFile = gfile.Join(tempDir, fileName)
)
@ -47,7 +47,7 @@ func ExampleSizeFormat() {
func ExampleReadableSize() {
// init
var (
fileName = "gflie_example.txt"
fileName = "gfile_example.txt"
tempDir = gfile.Temp("gfile_example_size")
tempFile = gfile.Join(tempDir, fileName)
)