t := &tenant.Tenant{}
err = l.restClient.Get(fmt.Sprintf("%s/tenants/%s", tenantURL, ns), t)
produces
2016/05/16 04:17:43 translateNetworkPolicy(): For namespace tenant-a got &tenant.Tenant{ID:0x0, ExternalID:"", Name:"", Segments:[]tenant.Segment(nil), Seq:0x0} / &errors.errorString{s:"Error json: cannot unmarshal array into Go value of type tenant.Tenant (<nil>) when parsing [{\"ID\":2,\"ExternalID\":\"680214b74eb14cd58a30a1c251aa2af6\",\"Name\":\"tenant-a\",\"Segments\":null,\"Seq\":2}]"}
2016/05/16 04:17:43 Error json: cannot unmarshal array into Go value of type tenant.Tenant (<nil>) when parsing [{"ID":2,"ExternalID":"680214b74eb14cd58a30a1c251aa2af6","Name":"tenant-a","Segments":null,"Seq":2}]
I couldn't find an easy way to fix it, changing tenant.go to return a single result doesn't help - clients always receive a list of httpResponses even if there is only one item.
Passing a slice of []Tenant{} into restClient.Get always returns empty slice because slice can't be modified by reference.
Relevant to https://github.com/romana/core/blob/fix/k8s-listener
Example in https://github.com/romana/core/blob/fix/k8s-listener/romana/kubernetes/listener.go#L286
produces
I couldn't find an easy way to fix it, changing tenant.go to return a single result doesn't help - clients always receive a list of httpResponses even if there is only one item.
Passing a slice of
[]Tenant{}
intorestClient.Get
always returns empty slice because slice can't be modified by reference.Need help.