My mind is not working and I can't find how to fix the following program 
(https://play.golang.org/p/oXxUndUSye):


package main


import (
 "fmt"
)


type set map[string]struct{}


var validSub set


func init() {
 validSub.Init([]string{"aa", "bb", "cc"})
 fmt.Printf("%+v\n", validSub)
}


func (s set) Init(slice []string) {
 s = make(map[string]struct{}, len(slice))
 for _, s1 := range slice {
 s[s1] = struct{}{}
 }
}


func (s set) Has(a string) bool { _, ok := s[a]; return ok }


func main() {
 fmt.Println(validSub.Has("aa"))
 fmt.Println(validSub.Has("dd"))
}



Please help.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to