# README
The deriveSet function is useful for creating a set of basic types which are comparable as a key in map.
Given the following input:
package set
func subset(set, sub []int) bool {
s := deriveSet(set)
for _, k := range sub {
if _, ok := s[k]; !ok {
return false
}
}
return true
}
goderive will generate the following code:
// Code generated by goderive DO NOT EDIT.
package set
// deriveSet returns the input list as a map with the items of the list as the keys of the map.
//
// Deprecated: In favour of generics.
func deriveSet(list []int) map[int]struct{} {
set := make(map[int]struct{}, len(list))
for _, v := range list {
set[v] = struct{}{}
}
return set
}