全球主机交流论坛

标题: golang大佬帮忙debug,付费 [打印本页]

作者: igoogle    时间: 2023-3-25 14:25
标题: golang大佬帮忙debug,付费
一个go程序,运行后报这个错误:

  1. 0|abc  | 2023/03/25 14:22:46 GetTokenInfo4Cache Key not found
  2. 0|abc  | <nil>
  3. 0|abc  | 2023/03/25 14:22:46 get token info from cache fail
  4. 0|abc  | error code: 1020
  5. 0|abc  | 2023/03/25 14:22:46 Unmarshal err: invalid character 'e' looking for beginning of value
  6. 0|abc  | 2023/03/25 14:22:46 get token info from api error invalid character 'e' looking for beginning of value
  7. 0|abc  | 2023/03/25 14:22:46 getTokenInfo err: invalid character 'e' looking for beginning of value
复制代码



invalid character 'e' looking for beginning of value这个错误网上找的方法改了,都没对,可能我技术太菜

请大佬来接单。
作者: Oneman    时间: 2023-3-25 14:28
提示: 作者被禁止或删除 内容自动屏蔽
作者: mengdodo    时间: 2023-3-25 14:29
缓存键值GetTokenInfo4Cache不存在,返回nil, 紧接着对nil执行了 json.Unmarshal , 那就报错咯
作者: igoogle    时间: 2023-3-25 14:43
Oneman 发表于 2023-3-25 14:28
是json? struct 反射做好了?

也是找论坛mjj写的一个go程序,说实话我不懂go,
恶补了一下,还是没改对。。
mjj联系不上
作者: Oneman    时间: 2023-3-25 14:48
提示: 作者被禁止或删除 内容自动屏蔽
作者: igoogle    时间: 2023-3-25 14:57
Oneman 发表于 2023-3-25 14:48
写好后debug没问题的么?看起来像是GetTokenInfo4Cache这个func获取不到key。api接口有变动了? ...

当时是没问题,后来才出现的这个问题。。
请求的是别人的api,可能是别人api发生了变化?
我网上查询的结果说是编码,和json数据结构的问题啊。。
作者: 大鸡鸡    时间: 2023-3-25 14:58
代码发出来
作者: igoogle    时间: 2023-3-25 21:30
大鸡鸡 发表于 2023-3-25 14:58
代码发出来

代码是个人用的,不方便发。。
作者: alsas    时间: 2023-3-25 21:35
2023/03/25 14:22:46 GetTokenInfo4Cache Key not found   
这个对应的Value 值是nil导致的报错
作者: ramiko    时间: 2023-3-25 21:39

2023/03/25 14:22:46 GetTokenInfo4Cache Key not found   
GetTokenInfo4Cache json这个键值对有问题把 要不这个不存在 要不他的value有问题
作者: igoogle    时间: 2023-3-25 21:50
Oneman 发表于 2023-3-25 14:48
写好后debug没问题的么?看起来像是GetTokenInfo4Cache这个func获取不到key。api接口有变动了? ...

大佬接单吗,帮我改下啊
作者: igoogle    时间: 2023-3-25 21:54
ramiko 发表于 2023-3-25 21:39
2023/03/25 14:22:46 GetTokenInfo4Cache Key not found   
GetTokenInfo4Cache json这个键值对有问题把  ...

我不知道啊,搞半天也找不到原因。。

大佬接单吗?
作者: igoogle    时间: 2023-3-25 22:00
alsas 发表于 2023-3-25 21:35
2023/03/25 14:22:46 GetTokenInfo4Cache Key not found   
这个对应的Value 值是nil导致的报错 ...

这个值是缓存的,如果缓存失效了,就会重新去请求api,所以错误的重点我觉得应该是在:
get token info from api error invalid character 'e' looking for beginning of value
作者: 懒无止境丶    时间: 2023-3-25 22:40
  1. get token info from api error
复制代码


这一段话应该是在代码里写死的,你全局搜一下差不多能定位到。然后关键代码发出来别人才能帮你
作者: yrj    时间: 2023-3-25 22:52
igoogle 发表于 2023-3-25 22:00
这个值是缓存的,如果缓存失效了,就会重新去请求api,所以错误的重点我觉得应该是在:
get token info f ...

都一天了还没解决?pm我QQ,我帮你看看吧。
作者: pathletboy    时间: 2023-3-25 23:10
你打印出获得的数据看看正不正常




欢迎光临 全球主机交流论坛 (https://www.iloc.eu.org/) Powered by Discuz! X3.4