mirror of
https://github.com/akvorado/akvorado.git
synced 2025-12-11 22:14:02 +01:00
16 lines
382 B
Go
16 lines
382 B
Go
// SPDX-FileCopyrightText: 2022 Free Mobile
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
package helpers
|
|
|
|
import "reflect"
|
|
|
|
// ElemOrIdentity returns Elem() of the provided value if this is an
|
|
// interface, else it returns the value unmodified.
|
|
func ElemOrIdentity(value reflect.Value) reflect.Value {
|
|
if value.Kind() == reflect.Interface {
|
|
value = value.Elem()
|
|
}
|
|
return value
|
|
}
|