在Google App Engine中查找主机(LookupHost)时出现错误。

huangapple go评论83阅读模式
英文:

LookupHost in Google App Engine errors

问题

我已经尝试了以下代码:

addresses, error := net.LookupHost("google.com")

在普通的Go环境和Google App Engine SDK中,它通常可以正常工作。

然而,在生产环境的GAE实例中,它会产生以下错误:

error reading DNS config: open /etc/resolv.conf: operation not permitted

这个问题会被修复吗?是否有解决方法?我能否在app.yaml配置中进行任何更改?

英文:

I've tried the following code:

addresses, error := net.LookupHost("google.com")

in regular Go and in the Google App Engine SDK, and it generally works fine.

However in a production GAE instance, it produces the following error:

error reading DNS config: open /etc/resolv.conf: operation not permitted

Will this be fixed, is there a workaround, can I change anything in the app.yaml configuration etc.?

答案1

得分: 4

你需要使用AppEngine API:

请注意,你还需要一个上下文(context)。

英文:

You'll need to use the AppEngine API:

Note you'll need a context there as well.

huangapple
  • 本文由 发表于 2013年9月6日 21:18:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/18658835.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定