Format and remove 07.5.md spaces
This commit is contained in:
30
zh/07.5.md
30
zh/07.5.md
@@ -23,14 +23,14 @@
|
|||||||
下面是演示代码:
|
下面是演示代码:
|
||||||
```Go
|
```Go
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
os.Mkdir("astaxie", 0777)
|
os.Mkdir("astaxie", 0777)
|
||||||
os.MkdirAll("astaxie/test1/test2", 0777)
|
os.MkdirAll("astaxie/test1/test2", 0777)
|
||||||
err := os.Remove("astaxie")
|
err := os.Remove("astaxie")
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
os.RemoveAll("astaxie")
|
os.RemoveAll("astaxie")
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -84,14 +84,14 @@
|
|||||||
写文件的示例代码
|
写文件的示例代码
|
||||||
```Go
|
```Go
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
userFile := "astaxie.txt"
|
userFile := "astaxie.txt"
|
||||||
fout, err := os.Create(userFile)
|
fout, err := os.Create(userFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -103,7 +103,7 @@
|
|||||||
fout.WriteString("Just a test!\r\n")
|
fout.WriteString("Just a test!\r\n")
|
||||||
fout.Write([]byte("Just a test!\r\n"))
|
fout.Write([]byte("Just a test!\r\n"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
### 读文件
|
### 读文件
|
||||||
@@ -120,14 +120,14 @@
|
|||||||
读文件的示例代码:
|
读文件的示例代码:
|
||||||
```Go
|
```Go
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
userFile := "asatxie.txt"
|
userFile := "asatxie.txt"
|
||||||
fl, err := os.Open(userFile)
|
fl, err := os.Open(userFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -143,7 +143,7 @@
|
|||||||
}
|
}
|
||||||
os.Stdout.Write(buf[:n])
|
os.Stdout.Write(buf[:n])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
### 删除文件
|
### 删除文件
|
||||||
|
|||||||
Reference in New Issue
Block a user