mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-11 00:40:00 +08:00
fix golint issues, exported doc (#451)
This commit is contained in:
@@ -2,14 +2,17 @@ package errorx
|
||||
|
||||
import "sync/atomic"
|
||||
|
||||
// AtomicError defines an atomic error.
|
||||
type AtomicError struct {
|
||||
err atomic.Value // error
|
||||
}
|
||||
|
||||
// Set sets the error.
|
||||
func (ae *AtomicError) Set(err error) {
|
||||
ae.err.Store(err)
|
||||
}
|
||||
|
||||
// Load returns the error.
|
||||
func (ae *AtomicError) Load() error {
|
||||
if v := ae.err.Load(); v != nil {
|
||||
return v.(error)
|
||||
|
||||
Reference in New Issue
Block a user