From 65e974a47c7200c884efc7b157da45967af030d6 Mon Sep 17 00:00:00 2001 From: Ziqi Zhao Date: Wed, 12 Oct 2022 12:45:43 +0800 Subject: [PATCH] fix for comments Signed-off-by: Ziqi Zhao --- internal/attribute/attribute.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/attribute/attribute.go b/internal/attribute/attribute.go index b43cbfc47f3..22034894473 100644 --- a/internal/attribute/attribute.go +++ b/internal/attribute/attribute.go @@ -12,12 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. +/* +Package attribute provide several helper functions for some commonly used +logic of processing attributes. +*/ package attribute // import "go.opentelemetry.io/otel/internal/attribute" import ( "reflect" ) +// SliceValue convert a slice into an array with same elements as slice. func SliceValue[T bool | int64 | float64 | string](v []T) any { var zero T cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))) @@ -25,6 +30,7 @@ func SliceValue[T bool | int64 | float64 | string](v []T) any { return cp.Elem().Interface() } +// AsSlice convert an array into a slice into with same elements as array. func AsSlice[T bool | int64 | float64 | string](v any) []T { rv := reflect.ValueOf(v) if rv.Type().Kind() != reflect.Array {