GitHub - magejiCoder/set: The Go generics hashset .

Skip to content

Navigation Menu

Sign in

Appearance settings

Generic Set

UnitTest codecov CodeQL

Port scylladb/go-set to Go Generics.

Usage

The usage is almost identical to the original set package.

But for customized type , the original set package needs to generate new type package via gen_set.sh; For generics set package , just uses it as the builtin type:

type CustomizedType struct {
	f string
}

 s:= New[CustomizedType]()
 s.Add(CustomizedType{"a"})
 if s.Has(CustomizedType{"a"}) {
	// do something
 }