Help us shape the future of Go! Take the 2026 Go Developer Survey

slices

package
v0.51.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AreStringSlicesEqual added in v0.28.0

func AreStringSlicesEqual(a, b []string) bool

AreStringSlicesEqual returns true if the two string slices are equal.

CAUTION: this function performs inplace sorts of the input slices.

func Concat

func Concat(slices [][]byte) []byte

Concat concatenates multiple []byte into one []byte with efficient one-time allocation.

func EnsureByteSliceSize

func EnsureByteSliceSize(b []byte, length int) []byte

EnsureByteSliceSize returns a copy of input bytes with given length trimming or left-padding with zero bytes accordingly

func Fill added in v0.39.0

func Fill[T any](val T, n int) []T

Fill constructs a slice of type T with length n. The slice is then filled with input "val".

func MakeRange added in v0.23.9

func MakeRange[T constraints.Integer](min, max T) []T

MakeRange returns a slice of numbers [min, max). The range includes min and excludes max.

func StringSliceContainsElement added in v0.28.0

func StringSliceContainsElement(a []string, v string) bool

StringSliceContainsElement returns true if the string slice contains the element.

func ToMap added in v0.48.0

func ToMap[T comparable](values []T) map[T]struct{}

ToMap converts a slice of any comparable type into a map where each element in the slice becomes a key in the map with the value set to a struct{}.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL