doc : add notes

This commit is contained in:
zhangwenjian committed 2020-07-27 22:45:47 +08:00
1 parent 1a50570f6c
commit f693ff60b2
3 files changed
+36 -2

No files matched your search

+2 -2
View File
@@ -40,8 +40,8 @@ func ExecSql(filePath string) error {
return nil
}
func Ioutil(name string) (string, error) {
if contents, err := ioutil.ReadFile(name); err == nil {
func Ioutil(filePath string) (string, error) {
if contents, err := ioutil.ReadFile(filePath); err == nil {
//因为contents是[]byte类型,直接转换成string类型后会多一行空格,需要使用strings.Replace替换换行符
result := strings.Replace(string(contents), "\n", "", 1)
fmt.Println("Use ioutil.ReadFile to read a file:", result)