Skip to content

Instantly share code, notes, and snippets.

@Grabber
Created September 29, 2024 00:01
Show Gist options
  • Select an option

  • Save Grabber/d2d6baa0ffef74406cdf366d89ca10ba to your computer and use it in GitHub Desktop.

Select an option

Save Grabber/d2d6baa0ffef74406cdf366d89ca10ba to your computer and use it in GitHub Desktop.
package main
type S struct {
Id string
}
var Sessions = make(map[string][]*S)
func main() {
sess_1 := &S{Id: "001"}
sess_2 := &S{Id: "010"}
sess_3 := &S{Id: "100"}
Sessions["usr1"] = append(Sessions["usr1"], sess_1)
Sessions["usr1"] = append(Sessions["usr1"], sess_2)
Sessions["usr1"] = append(Sessions["usr1"], sess_3)
if sessu, ok := Sessions["usr1"]; ok {
for k, sess := range sessu {
if sess == sess_3 {
sessu = append(sessu[:k], sessu[k+1:]...)
break
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment