kr / hk

Fast Heroku client
https://hk.heroku.com/
77 stars 6 forks source link

hk env error #5

Closed mmcgrana closed 12 years ago

mmcgrana commented 12 years ago
$ hk env -a ion-mark
json: cannot unmarshal number into Go value of type string

$ heroku config -a ion-mark | head -n 1
=== Config Vars for ion-mark
...

$ hk version
0.6
bmizerany commented 12 years ago

Since when is an environment var a number? Sounds like an API bug.

On Jun 21, 2012, at 8:01 PM, Mark McGranaghanreply@reply.github.com wrote:

$ hk env -a ion-mark
json: cannot unmarshal number into Go value of type string

$ heroku config -a ion-mark | head -n 1
=== Config Vars for ion-mark
...

$ hk version
0.6

Reply to this email directly or view it on GitHub: https://github.com/kr/hk/issues/5

mmcgrana commented 12 years ago

@bmizerany can you elaborate? Would data like this give the JSON lib trouble?

$ curl -nis https://api.heroku.com/apps/ion-mark/config_vars | json | head -n 4
{
  "NO_GPG": "1",
  "ENABLE_VOLUME_DESTRUCTION": "1",
  "ENABLE_LOCAL_SHEPHERD": "1",
bmizerany commented 12 years ago

Is a value is a number (I.e digits not in parens) and the field it is in matches a name of a field in the struct that is of type string, and there are no hints to the decoder to treat the field as a string unconditionally, then yes, the decoder will return an error.

The struct we fill in hk id a map of string to string, so an integer type in the JSON would cause this error.

I am suggesting the error lies in the API because an environment variable is never anything other than a string.

Do you have the rest of the JSON? It looks cut off.

I could be a bug on our end but I think it's unlikely.

On Jun 21, 2012, at 9:53 PM, Mark McGranaghanreply@reply.github.com wrote:

@bmizerany can you elaborate? Would data like this give the JSON lib trouble?

$ curl -nis https://api.heroku.com/apps/ion-mark/config_vars | json | head -n 4
{
 "NO_GPG": "1",
 "ENABLE_VOLUME_DESTRUCTION": "1",
 "ENABLE_LOCAL_SHEPHERD": "1",

Reply to this email directly or view it on GitHub: https://github.com/kr/hk/issues/5#issuecomment-6500593

mmcgrana commented 12 years ago

Ahh interesting - I found it:

$ curl -nis https://api.heroku.com/apps/ion-mark/config_vars | json | grep INC
  "ION_INCARNATION": 1340308737,

I will investigate with API. Thanks!

bmizerany commented 12 years ago

Man. I'm impressed I got that point across while at the GoSF drink-up while on an iPhone. :)