markphelps / optional

Optional is a library of optional Go types
https://godoc.org/github.com/markphelps/optional
MIT License
210 stars 19 forks source link

Move set to a pointer reciever #5

Closed dmarkham closed 6 years ago

dmarkham commented 6 years ago

This will allow set to set what your trying to set and not a copy.

dmarkham commented 6 years ago

Here is an a sample of why I think this patch is important, It's even harder to debug/grok why it does not behave like one would expect when your optional is part of a struct.

https://play.golang.org/p/rBKKJxOTTgU

markphelps commented 6 years ago

Wow major oversight on my part. Thank you! Seems I need to add some tests for set