-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathabout.go
More file actions
42 lines (35 loc) · 898 Bytes
/
about.go
File metadata and controls
42 lines (35 loc) · 898 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package main
import (
"fmt"
"os"
"strings"
"github.com/ProtossGenius/SureMoonNet/basis/smn_file"
)
func check(err error) {
if err != nil {
panic(err)
}
}
func main() {
_, err := smn_file.DeepTraversalDirWithSelf("./", func(path string, info os.FileInfo) smn_file.FileDoFuncResult {
if info.IsDir() {
return smn_file.FILE_DO_FUNC_RESULT_DEFAULT
}
if !strings.HasSuffix(info.Name(), ".go") {
return smn_file.FILE_DO_FUNC_RESULT_NO_DEAL
}
fmt.Println(path)
data, err := smn_file.FileReadAll(path)
check(err)
f, err := smn_file.CreateNewFile(path)
check(err)
defer f.Close()
str := strings.ReplaceAll(string(data), "\"github.com/ProtossGenius/smnric/",
`"github.com/ProtossGenius/smnric/`)
str = strings.ReplaceAll(str, "snreader.", "snreader.")
_, err = f.WriteString(str)
check(err)
return smn_file.FILE_DO_FUNC_RESULT_DEFAULT
})
check(err)
}