Files
akvorado/common/helpers/reflect.go
Vincent Bernat 3f1dc38052 Revert "inlet/snmp: do not deprecate default-community"
This reverts commit e5d3d3fbc3. When
adding SNMPv3, it will be odd to have this. Just put the extra mile to
deprecate it correctly.
2022-08-13 21:33:53 +02:00

16 lines
381 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 {
return value.Elem()
}
return value
}