1

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?

voodoogiant
  • 2,118
  • 6
  • 29
  • 49

1 Answers1

0

"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.
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250