I'm slicing a comma delimited string with strings.Split()
and am able to extract the desired sub-slice.
friends := string("9q4kq,9q47y,9q4kp,9q4kj,9q4km,9q47v,9q4kr,9q47z")
s := strings.Split(friends, ",")
f0:= s[0]
datastore.NewQuery()
chokes (no records returned) when I specify the Filter component of datastore.NewQuery()
using the slice f0
:
Filter("Field1 =", f0)
same result using
Filter("Field1 =", string(f0))
However, when I hardcode the Filter component, I get the desired records:
Filter("Field1 =", "9q4kq")
What is the the right way to refer to these slices in the Filter ?
Please see http://play.golang.org/p/DxPAgq3H28.
I did a global find and replace of f0
with randomLowerCaseVar
and the darn thing works.
It seems to me that f0
is a legit identifier [http://golang.org/ref/spec] and not reserved in any way.
What is the the right way to refer to these slices in the Filter ?
I think the answer is "use a string variable not named f0
"
By the way, F0
also works as a string variable name.