doujumiao5024 2014-08-05 04:36
浏览 232

将git-submodule导入golang gae应用程序

I have a submodule in my golang google-app-engine project that I would like to add to my path.

$ ls ./openid/src/openid
discover.go             integration          verify.go
discover_test.go        nonce_store.go       xrds.go
discovery_cache.go      nonce_store_test.go  xrds_test.go
fake_getter_test.go     normalizer.go        yadis_discovery.go
getter.go               normalizer_test.go   yadis_discovery_test.go
html_discovery.go       redirect.go
html_discovery_test.go  redirect_test.go

In the example code for this package, it imports "openid". I'm new to golang's import rules, and I can't for the life of me figure out what I need to put in the import statement of my main file to import this package. I've tried "openid/src/openid", "myapp/openid/src/openid", etc. Can someone provide some clarification of how this works? Or do I need to actually modify the app.yaml file?

  • 写回答

1条回答 默认 最新

  • duanmu8911 2014-08-05 05:20
    关注

    "Organizing Go code" mentions:

    An import path is the string with which users import a package.
    It specifies the directory (relative to $GOROOT/src/pkg or $GOPATH/src) in which the package's source code resides.

    So make sure to use an import statement referring to a path which exists in your $GOPATH/src. (GOPATH being your "workspace", in which you have namespaces, as shown in this video).
    Also make sure you build first openid/src/openid sources. And install it (go install).

    As detailed in this answer:

    • Import paths can be be globally unique.
    • In conjunction with GOPATH, import path can be translated unambiguously to a directory path.
    • Any directory path under GOPATH can be unambiguously translated to an import path.
    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!