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.
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。