What: add spec for array ops with []uint8 or []byte type by mcspring · Pull Request #128 · globalsign/mgo (original) (raw)
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nitpick here ( sorry! )
IIRC map[string]struct{} could be used here, and that one has an optimised lookup code when you want to only check for the presence of an element.
this would transform the map lookups to
if _, ok := arrayOps[name]; ok {
[...]
}
Which is not as clean. I'll let you make a call here. I haven't benchmarked the code, so I can't tell how much faster it is, but it is the idiomatic go way of doing things FWIW.