Hi, Sorry, it was my stupid mistake. I was deleting with wrong key.
@Kurtis: "That should work once you correct the initialization of the map" Is my map initialization not the best way? I mean var CtxStarStore = make(map[string]AuthCtx) I would like to CtxStarStore would be access globally. Is there a better way to initialize it. Thanks for the response. -- Fury On Friday, November 19, 2021 at 6:09:04 PM UTC+2 Kurtis Rader wrote: > On Fri, Nov 19, 2021 at 7:17 AM Van Fury <fury...@gmail.com> wrote: > >> I have a map as shown below >> >> var CtxStarStore = make(map[string]AuthCtx) >> >> map[ccc-999401002:{989c48c5-7f9c-4058-80a2-b769ea4675f9 imei-1234010002} >> bbb-999401003:{989c48c5-7f9c-4058-80a2-b769ea4675f9 imei-1234010003}] >> > > This isn't legal Go. > > >> I would like to delete ccc-999401002 or any key value from the map I >> tried delete as >> s := "ccc-999401002" >> >> delete(CtxStarStore, s) >> > > That should work once you correct the initialization of the map. > > >> Any reason why I cannot delete it >> >> No idea since you didn't provide us with an example of code that > compiles. It's usually a good idea to enter your example at > https://play.golang.com to verify it at least compiles then include a > link to that code in your message. > > -- > Kurtis Rader > Caretaker of the exceptional canines Junior and Hank > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/35456fe4-4d70-49a2-9c6f-3e7439128698n%40googlegroups.com.