Go程序编译但运行时返回奇怪的错误

时间:2014-04-05 08:10:24

标签: url go google-url-shortener

所以我是Golang的新手(今天开始学习),我一直在编写URL缩短程序,但是在运行go install然后从CLI运行已编译的程序后,它会返回此错误:

2014/04/05 19:05:27 invalid character '<' looking for beginning of value
exit status 1

代码引用:https://github.com/hullswitch/urlshortnr

1 个答案:

答案 0 :(得分:1)

您的问题是由您对Google URL Shortener的请求引起的。它返回一个404错误与HTML正文而不是JSON。您可以在log.Println(string(output))之后调试将if添加到err处理Unmarshal