Like Prometheus, but for logs.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
loki/pkg/dataobj/internal/util/sliceclear/sliceclear.go

11 lines
397 B

// Package sliceclear provides a way to clear and truncate the length of a
// slice.
package sliceclear
// Clear zeroes out all values in s and returns s[:0]. Clear allows memory of
// previous elements in the slice to be reclained by the garbage collector
// while still allowing the underlying slice memory to be reused.
func Clear[Slice ~[]E, E any](s Slice) Slice {
clear(s)
return s[:0]
}