You are comparing two different strings. (Go does not use null
termination for its strings.)
I'm not sure about "most efficient", but a relatively simple way is
strings.TrimRight:
http://play.golang.org/p/1H_blATQVM
Note that if your null-terminated string comes via cgo, the C.GoString
function should take care of the conversion for you.
-Caleb
> --
> 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...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.