Skip to content

Commit 4afdafd

Browse files
author
Anchor
committed
Fix grammar and typos for 07.5.md
1 parent 716a30f commit 4afdafd

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

en/eBook/07.5.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
# 7.5 Files
22

3-
File is must-have object in every single computer device, and web applications also have many usage with files. In this section, we're going to learn how to operate files in Go.
3+
Files are must-have objects on every single computer device. It won't come as any surprise to you that web applications also make heavy use of them. In this section, we're going to learn how to operate on files in Go.
44

55
## Directories
66

7-
Most of functions of file operations is in package `os`, here are some functions about directories:
7+
In Go, most of the file operation functions are located in the `os` package. Here are some directory functions:
88

99
- func Mkdir(name string, perm FileMode) error
1010

11-
Create directory with `name`, `perm` is permission, like 0777.
11+
Create a directory with `name`. `perm` is the directory permissions, i.e 0777.
1212

1313
- func MkdirAll(path string, perm FileMode) error
1414

1515
Create multiple directories according to `path`, like `astaxie/test1/test2`.
1616

1717
- func Remove(name string) error
1818

19-
Remove directory with `name`, it returns error if it's not directory or not empty.
19+
Removes directory with `name`. Returns error if it's not a directory or not empty.
2020

2121
- func RemoveAll(path string) error
2222

23-
Remove multiple directories according to `path`, it will not be deleted if `path` is a single path.
23+
Removes multiple directories according to `path`. Directories will not be deleted if `path` is a single path.
2424

2525
Code sample:
2626

@@ -45,42 +45,42 @@ Code sample:
4545

4646
### Create and open files
4747

48-
Two functions to create files:
48+
There are two functions for creating files:
4949

5050
- func Create(name string) (file *File, err Error)
5151

52-
Create file with `name` and return a file object with permission 0666 and read-writable.
52+
Create a file with `name` and return a read-writable file object with permission 0666.
5353

5454
- func NewFile(fd uintptr, name string) *File
5555

56-
Create file and return a file object.
56+
Create a file and return a file object.
5757

5858

59-
Two functions to open files:
59+
There are also two functions to open files:
6060

6161
- func Open(name string) (file *File, err Error)
6262

63-
Open file with `name` with read-only permission, it calls `OpenFile` underlying.
63+
Opens a file called `name` with read-only access, calling `OpenFile` under the covers.
6464

6565
- func OpenFile(name string, flag int, perm uint32) (file *File, err Error)
6666

67-
Open file with `name`, `flag` is open mode like read-only, read-write, `perm` is permission.
67+
Opens a file called `name`. `flag` is open mode like read-only, read-write, etc. `perm` are the file permissions.
6868

6969
### Write files
7070

7171
Functions for writing files:
7272

7373
- func (file *File) Write(b []byte) (n int, err Error)
7474

75-
Write byte type content to file.
75+
Write byte type content to a file.
7676

7777
- func (file *File) WriteAt(b []byte, off int64) (n int, err Error)
7878

79-
Write byte type content to certain position of file.
79+
Write byte type content to a specific position of a file.
8080

8181
- func (file *File) WriteString(s string) (ret int, err Error)
8282

83-
Write string to file.
83+
Write a string to a file.
8484

8585
Code sample:
8686

@@ -146,14 +146,14 @@ Code sample:
146146

147147
### Delete files
148148

149-
Go uses same function for removing files and directories:
149+
Go uses the same function for removing files and directories:
150150

151151
- func Remove(name string) Error
152152

153-
Remove file or directory with `name`.( ***`name` ends with `/` means directory*** )
153+
Remove a file or directory called `name`.( *** a `name` ending with `/` signifies that it's a directory*** )
154154

155155
## Links
156156

157157
- [Directory](preface.md)
158158
- Previous section: [Templates](07.4.md)
159-
- Next section: [Strings](07.6.md)
159+
- Next section: [Strings](07.6.md)

0 commit comments

Comments
 (0)