Skip to content

Commit 63db876

Browse files
committed
chore: fix typo and syntax error
1 parent c5cc5c2 commit 63db876

13 files changed

+27
-28
lines changed

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ We use [git-flow](https://nvie.com/posts/a-successful-git-branching-model/) as o
1414
We are using [Github Issues](https://github.com/cloudwego/netpoll/issues) for our public bugs. We keep a close eye on this and try to make it clear when we have an internal fix in progress. Before filing a new task, try to make sure your problem doesn’t already exist.
1515

1616
### 2. Reporting New Issues
17-
Providing a reduced test code is a recommended way for reporting issues. Then can placed in:
17+
Providing a reduced test code is a recommended way for reporting issues. Then can be placed in:
1818
- Just in issues
1919
- [Golang Playground](https://play.golang.org/)
2020

@@ -45,9 +45,9 @@ Before you submit your Pull Request (PR) consider the following guidelines:
4545
4646
## Contribution Prerequisites
4747
- Our development environment keeps up with [Go Official](https://golang.org/project/).
48-
- You need fully checking with lint tools before submit your pull request. [gofmt](https://golang.org/pkg/cmd/gofmt/) and [golangci-lint](https://github.com/golangci/golangci-lint)
48+
- You need to fully check with lint tools before submitting your pull request. [gofmt](https://golang.org/pkg/cmd/gofmt/) and [golangci-lint](https://github.com/golangci/golangci-lint)
4949
- You are familiar with [Github](https://github.com)
50-
- Maybe you need familiar with [Actions](https://github.com/features/actions)(our default workflow tool).
50+
- Maybe you need to be familiar with [Actions](https://github.com/features/actions)(our default workflow tool).
5151
5252
## Code Style Guides
5353
- [Effective Go](https://golang.org/doc/effective_go)

_typos.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@ extend-exclude = ["go.mod", "go.sum"]
66
[default.extend-identifiers]
77
# *sigh* this just isn't worth the cost of fixing
88
nd = "nd"
9-
paniced = "paniced"
109
write_datas = "write_datas"

connection_errors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
const (
2525
// The connection closed when in use.
2626
ErrConnClosed = syscall.Errno(0x101)
27-
// Read I/O buffer timeout, calling by Connection.Reader
27+
// Read I/O buffer timeout, called by Connection.Reader
2828
ErrReadTimeout = syscall.Errno(0x102)
2929
// Dial timeout
3030
ErrDialTimeout = syscall.Errno(0x103)

connection_impl.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const (
3232
connStateDisconnected = 2
3333
)
3434

35-
// connection is the implement of Connection
35+
// connection is the implementation of Connection
3636
type connection struct {
3737
netFD
3838
onEvent

connection_lock.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const (
5353
)
5454

5555
type locker struct {
56-
// keychain use for lock/unlock/stop operation by who.
56+
// keychain used for lock/unlock/stop operation by who.
5757
// 0 means unlock, 1 means locked, 2 means stop.
5858
keychain [total]int32
5959
}

connection_onevent.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ func (c *connection) onProcess(onConnect OnConnect, onRequest OnRequest) (proces
231231
if closedBy != none {
232232
// if closed by user when processing, it "may" needs detach
233233
needDetach := closedBy == user
234-
// Here is a conor case that operator will be detached twice:
234+
// Here is a corner case that operator will be detached twice:
235235
// If server closed the connection(client OnHup will detach op first and closeBy=poller),
236236
// and then client's OnRequest function also closed the connection(closeBy=user).
237237
// But operator already prevent that detach twice will not cause any problem
@@ -240,7 +240,7 @@ func (c *connection) onProcess(onConnect OnConnect, onRequest OnRequest) (proces
240240
return
241241
}
242242
c.unlock(processing)
243-
// Note: Poller's closeCallback call will try to get processing lock failed but here already neer to unlock processing.
243+
// Note: Poller's closeCallback call will try to get processing lock failed but here already near to unlock processing.
244244
// So here we need to check connection state again, to avoid connection leak
245245
// double check close state
246246
if c.status(closing) != 0 && c.lock(processing) {

docs/guide/guide_cn.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ func main() {
190190
var conn netpoll.Connection
191191
var reader, writer = conn.Reader(), conn.Writer()
192192

193-
// reading
193+
// reading
194194
buf, _ := reader.Next(n)
195195
... parse the read data ...
196196
reader.Release()
@@ -199,7 +199,7 @@ func main() {
199199
var write_data []byte
200200
... make the write data ...
201201
alloc, _ := writer.Malloc(len(write_data))
202-
copy(alloc, write_data) // write data
202+
copy(alloc, write_data) // write data
203203
writer.Flush()
204204
}
205205
```
@@ -430,7 +430,7 @@ func main() {
430430

431431
// or
432432

433-
// 2. setting with Option
433+
// 2. setting with Option
434434
netpoll.NewEventLoop(handler, netpoll.WithReadTimeout(timeout))
435435
...
436436
}
@@ -455,7 +455,7 @@ func main() {
455455

456456
// or
457457

458-
// 2. setting with Option
458+
// 2. setting with Option
459459
netpoll.NewEventLoop(handler, netpoll.WithIdleTimeout(timeout))
460460
...
461461
}

docs/guide/guide_en.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ func main() {
203203
var conn netpoll.Connection
204204
var reader, writer = conn.Reader(), conn.Writer()
205205

206-
// reading
206+
// reading
207207
buf, _ := reader.Next(n)
208208
... parse the read data ...
209209
reader.Release()
@@ -212,7 +212,7 @@ func main() {
212212
var write_data []byte
213213
... make the write data ...
214214
alloc, _ := writer.Malloc(len(write_data))
215-
copy(alloc, write_data) // write data
215+
copy(alloc, write_data) // write data
216216
writer.Flush()
217217
}
218218
```
@@ -457,7 +457,7 @@ func main() {
457457

458458
// or
459459

460-
// 2. setting with Option
460+
// 2. setting with Option
461461
netpoll.NewEventLoop(handler, netpoll.WithReadTimeout(timeout))
462462
...
463463
}
@@ -487,7 +487,7 @@ func main() {
487487

488488
// or
489489

490-
// 2. setting with Option
490+
// 2. setting with Option
491491
netpoll.NewEventLoop(handler, netpoll.WithIdleTimeout(timeout))
492492
...
493493
}

net_dialer.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ func DialConnection(network, address string, timeout time.Duration) (connection
2828
return defaultDialer.DialConnection(network, address, timeout)
2929
}
3030

31-
// NewFDConnection create a Connection initialed by any fd
32-
// It's useful for write unit test for functions have args with the type of netpoll.Connection
33-
// The typical usage like:
31+
// NewFDConnection create a Connection initialized by any fd
32+
// It's useful for writing unit tests for functions that have args with the type of netpoll.Connection
33+
// The typical usage is like:
3434
//
3535
// rfd, wfd := netpoll.GetSysFdPairs()
3636
// rconn, _ = netpoll.NewFDConnection(rfd)

netpoll_unix_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -457,12 +457,12 @@ func TestServerPanicAndClose(t *testing.T) {
457457

458458
network, address := "tcp", getTestAddress()
459459
sendMsg := []byte("hello")
460-
var paniced int32
460+
var panicked int32
461461
loop := newTestEventLoop(network, address,
462462
func(ctx context.Context, connection Connection) error {
463463
_, err := connection.Reader().Next(len(sendMsg))
464464
MustNil(t, err)
465-
atomic.StoreInt32(&paniced, 1)
465+
atomic.StoreInt32(&panicked, 1)
466466
panic("test")
467467
},
468468
)
@@ -474,7 +474,7 @@ func TestServerPanicAndClose(t *testing.T) {
474474
err = conn.Writer().Flush()
475475
MustNil(t, err)
476476

477-
for atomic.LoadInt32(&paniced) == 0 {
477+
for atomic.LoadInt32(&panicked) == 0 {
478478
runtime.Gosched() // wait for poller close connection
479479
}
480480
for conn.IsActive() {

0 commit comments

Comments
 (0)