From a5962f677fa6ad9a1b3ceb1165d27b94fa4aff54 Mon Sep 17 00:00:00 2001 From: heyanfu <1145291570@qq.com> Date: Mon, 10 May 2021 00:09:00 +0800 Subject: [PATCH] fix some typo (#677) --- core/queue/queue.go | 2 +- core/stat/internal/cpu_linux.go | 2 +- core/syncx/managedresource.go | 2 +- core/syncx/once.go | 2 +- core/syncx/onceguard.go | 2 +- core/syncx/pool.go | 4 ++-- core/syncx/refresource.go | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/core/queue/queue.go b/core/queue/queue.go index f6dd85cf..250a8937 100644 --- a/core/queue/queue.go +++ b/core/queue/queue.go @@ -71,7 +71,7 @@ func NewQueue(producerFactory ProducerFactory, consumerFactory ConsumerFactory) return q } -// AddListener adds a litener to q. +// AddListener adds a listener to q. func (q *Queue) AddListener(listener Listener) { q.listeners = append(q.listeners, listener) } diff --git a/core/stat/internal/cpu_linux.go b/core/stat/internal/cpu_linux.go index 9589189d..9f23a420 100644 --- a/core/stat/internal/cpu_linux.go +++ b/core/stat/internal/cpu_linux.go @@ -22,7 +22,7 @@ var ( cores uint64 ) -// if /proc not present, ignore the cpu calcuation, like wsl linux +// if /proc not present, ignore the cpu calculation, like wsl linux func init() { cpus, err := perCpuUsage() if err != nil { diff --git a/core/syncx/managedresource.go b/core/syncx/managedresource.go index 65d85162..7c3fd693 100644 --- a/core/syncx/managedresource.go +++ b/core/syncx/managedresource.go @@ -18,7 +18,7 @@ func NewManagedResource(generate func() interface{}, equals func(a, b interface{ } } -// MarkBroken marks the resouce broken. +// MarkBroken marks the resource broken. func (mr *ManagedResource) MarkBroken(resource interface{}) { mr.lock.Lock() defer mr.lock.Unlock() diff --git a/core/syncx/once.go b/core/syncx/once.go index 992d5102..8915eca5 100644 --- a/core/syncx/once.go +++ b/core/syncx/once.go @@ -2,7 +2,7 @@ package syncx import "sync" -// Once returns a func that guanartees fn can only called once. +// Once returns a func that guarantees fn can only called once. func Once(fn func()) func() { once := new(sync.Once) return func() { diff --git a/core/syncx/onceguard.go b/core/syncx/onceguard.go index b4afd5ee..c6b867e3 100644 --- a/core/syncx/onceguard.go +++ b/core/syncx/onceguard.go @@ -2,7 +2,7 @@ package syncx import "sync/atomic" -// A OnceGuard is used to make sure a resouce can be taken once. +// A OnceGuard is used to make sure a resource can be taken once. type OnceGuard struct { done uint32 } diff --git a/core/syncx/pool.go b/core/syncx/pool.go index 983c7562..41d4a52c 100644 --- a/core/syncx/pool.go +++ b/core/syncx/pool.go @@ -19,7 +19,7 @@ type ( // A Pool is used to pool resources. // The difference between sync.Pool is that: - // 1. the limit of the resouces + // 1. the limit of the resources // 2. max age of the resources can be set // 3. the method to destroy resources can be customized Pool struct { @@ -56,7 +56,7 @@ func NewPool(n int, create func() interface{}, destroy func(interface{}), opts . return pool } -// Get gets a resouce. +// Get gets a resource. func (p *Pool) Get() interface{} { p.lock.Lock() defer p.lock.Unlock() diff --git a/core/syncx/refresource.go b/core/syncx/refresource.go index cc6a224f..dd59585d 100644 --- a/core/syncx/refresource.go +++ b/core/syncx/refresource.go @@ -8,7 +8,7 @@ import ( // ErrUseOfCleaned is an error that indicates using a cleaned resource. var ErrUseOfCleaned = errors.New("using a cleaned resource") -// A RefResource is used to reference counting a resouce. +// A RefResource is used to reference counting a resource. type RefResource struct { lock sync.Mutex ref int32