Is there a reason you are using `container/list`, in most cases it's the wrong solution. Slices in most cases are faster and use less resources and easier to work with.
+ Egon On Tuesday, 29 August 2017 01:50:10 UTC+3, BeaT Adrian wrote: > > Hello, I just started to learn golang and I have a small dillema. > > My programming is too defensive OR how can I replicate this scenario (for > my test coverage sake) > > list = list.New() > element := list.PushBack(item) > if element == nil { > //don't know how this can happen, just being defensive > return false > } > > > or > element:= list.Back() > //can element be nil ? > > I browsed the list.List code but still haven't found a solution how to > replicate this case. > > Thanks!! > > -- 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.