aboutsummaryrefslogtreecommitdiff
path: root/vendor/go.uber.org/atomic/error.go
diff options
context:
space:
mode:
authorPaul Holzinger <paul.holzinger@web.de>2020-09-10 22:36:19 +0200
committerPaul Holzinger <paul.holzinger@web.de>2020-11-12 11:32:03 +0100
commitdf4bf5c584f264bdefef5cb30d85c036260eff8f (patch)
tree8d71634cc63feac5020dfdfc745d178457b50805 /vendor/go.uber.org/atomic/error.go
parentea753128952e1a6d4b56cc80d232f6dbfb420ba5 (diff)
downloadpodman-df4bf5c584f264bdefef5cb30d85c036260eff8f.tar.gz
podman-df4bf5c584f264bdefef5cb30d85c036260eff8f.tar.bz2
podman-df4bf5c584f264bdefef5cb30d85c036260eff8f.zip
Vendor in some cobra PRs to improve the completion experience.
This is only temporary until the cobra following PRs are merged: - PR#1258 Custom completion handle multiple shorhand flags together - PR#1249 Fix fish handling of "ShellCompDirectiveNoSpace" and file completion - PR#1213 Fix zsh completion handling of nospace and file completion - PR#1146 Bash completion V2 with completion descriptions Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Diffstat (limited to 'vendor/go.uber.org/atomic/error.go')
-rw-r--r--vendor/go.uber.org/atomic/error.go48
1 files changed, 22 insertions, 26 deletions
diff --git a/vendor/go.uber.org/atomic/error.go b/vendor/go.uber.org/atomic/error.go
index 0489d19ba..a6166fbea 100644
--- a/vendor/go.uber.org/atomic/error.go
+++ b/vendor/go.uber.org/atomic/error.go
@@ -1,4 +1,6 @@
-// Copyright (c) 2016 Uber Technologies, Inc.
+// @generated Code generated by gen-atomicwrapper.
+
+// Copyright (c) 2020 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -20,36 +22,30 @@
package atomic
-// Error is an atomic type-safe wrapper around Value for errors
-type Error struct{ v Value }
-
-// errorHolder is non-nil holder for error object.
-// atomic.Value panics on saving nil object, so err object needs to be
-// wrapped with valid object first.
-type errorHolder struct{ err error }
+// Error is an atomic type-safe wrapper for error values.
+type Error struct {
+ _ nocmp // disallow non-atomic comparison
-// NewError creates new atomic error object
-func NewError(err error) *Error {
- e := &Error{}
- if err != nil {
- e.Store(err)
- }
- return e
+ v Value
}
-// Load atomically loads the wrapped error
-func (e *Error) Load() error {
- v := e.v.Load()
- if v == nil {
- return nil
+var _zeroError error
+
+// NewError creates a new Error.
+func NewError(v error) *Error {
+ x := &Error{}
+ if v != _zeroError {
+ x.Store(v)
}
+ return x
+}
- eh := v.(errorHolder)
- return eh.err
+// Load atomically loads the wrapped error.
+func (x *Error) Load() error {
+ return unpackError(x.v.Load())
}
-// Store atomically stores error.
-// NOTE: a holder object is allocated on each Store call.
-func (e *Error) Store(err error) {
- e.v.Store(errorHolder{err: err})
+// Store atomically stores the passed error.
+func (x *Error) Store(v error) {
+ x.v.Store(packError(v))
}