douban2014 2013-11-08 05:43
浏览 78
已采纳

找不到软件包“ appengine / cloudsql”

I develop some GO libraries using Google Cloud SQL and MySQL server. When I imported `appengine/cloudsql, an error below occured.

cloud.go:20:2: cannot find package "appengine/cloudsql" in any of: /usr/local/Cellar/go/1.1.2/src/pkg/appengine/cloudsql (from $GOROOT) /Users/lameduck/myGo/src/appengine/cloudsql (from $GOPATH)

I know this package, appengine/cloudsql, is only for Google App Engine and it doesn't exist on everywhere else.

I'm wondering how can I use it for GAE and standard sql library for other environments in a single library.

PS: I can setup Google App Engine SDK correctly. My question is not relevant to it. I hope my library runs on Google App Engine and standalone environment together. (I already made a code for GAE and a code for other dabatases.) It is Ok that users have to setup some configurations. But I don't want that users have to modify a library source code.

Thanks for any help.

  • 写回答

2条回答 默认 最新

  • dsfasdfsda234234 2013-11-08 15:54
    关注

    I solved the problem. I used a build constraint to use the proper routine and avoid an error. There is a build constraint for App Engine, appengine.

    The App Engine SDK introduces a new build constraint term: "appengine". Files that specify

    // +build appengine will be built by the App Engine SDK and ignored by the go tool. Conversely, files that specify

    // +build !appengine are ignored by the App Engine SDK, while the go tool will happily build them.

    PS: Anway, I upvoted other answers. Thank you.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度