Go中出现奇怪的数据存储错误,“种类是空字符串”

I am recently getting an error that I have never seen before when making a simple datastore.GetAll() request. I can't figure out what it means and I can't find any documentation with the error message or any help from Googleing the error message.

Here's my code:

type MyUnderlyingStruct struct {
    ApplyTo             *datastore.Key
    ApplyFrom           *datastore.Key
    Amount              float64
    LocationKey         *datastore.Key
    DepartmentKey       *datastore.Key
    SubjectAreaKey      *datastore.Key
}

type MyStruct []MyUnderlyingStruct 

//In the case where I get the error someKey is a valid, complete Key value
//  of a different kind that what we are querying for and there is actually
//  an entity in my datastore that matches this query
func (x *MyStruct) Load(w http.ResponseWriter, r *http.Request, someKey *datastore.Key) (error) {
    c := appengine.NewContext(r)
    q := datastore.NewQuery("MyUnderlyingStruct_KindName").Order("-Amount")
    if someKey != nil { q = q.Filter("ApplyTo=", someKey) }

    keys, err := q.GetAll(c,x)
    if _, ok := err.(*datastore.ErrFieldMismatch); ok { err = nil }
    if err != nil && err != datastore.Done {return err}
    return nil
}

Which returns this error:

API error 1 (datastore_v3: BAD_REQUEST): The kind is the empty string.

Can anyone tell me why I am getting this error, or what it is trying to tell me?

Looking at your issue on the first glance (because I am not familiar with Google's datastore API), it seems to me the problem is a result of zeroed-memory initialization using new keyword.

When a struct is created with the keyword without assigning starting values for the fields, 0's are given as default. When mapped to string, it's "" (empty). Go actually threw a very helpful error for you.

As you have pointed out, you have used Mykey := new(datastore.Key). Thanks for your generosity and this can serve as answer for future users.