MCPcopy Create free account
hub / github.com/AlekSi/pointer / ToErrorOrNil

Function ToErrorOrNil

pointer_or_nil.go:48–53  ·  view source on GitHub ↗

ToErrorOrNil returns a pointer to the passed error value, or nil, if passed value is a zero value.

(e error)

Source from the content-addressed store, hash-verified

46
47// ToErrorOrNil returns a pointer to the passed error value, or nil, if passed value is a zero value.
48func ToErrorOrNil(e error) *error {
49 if e == nil {
50 return nil
51 }
52 return &e
53}
54
55// ToFloat32OrNil returns a pointer to the passed float32 value, or nil, if passed value is a zero value.
56func ToFloat32OrNil(f float32) *float32 {

Callers 1

TestErrorFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestErrorFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…