5

I am using go 1.5.3. I ran this

go get -x github.com/goji/goji

and I am getting this error message:

git checkout master
package github.com/goji/goji
imports goji.io/internal: use of internal package not allowed

How do I resolve this ?

canadadry
  • 8,115
  • 12
  • 51
  • 68
  • It's because the folder path you checked out into doesn't match the import paths in the source code. As a result the go compiler thinks you are trying to use internal things from some other repo. – Tim Abell Aug 09 '18 at 07:36
  • See also https://stackoverflow.com/q/41060764/10245 – Tim Abell Aug 09 '18 at 07:36
  • See also https://stackoverflow.com/q/46040715/10245 – Tim Abell Aug 09 '18 at 07:36
  • Make sure to set [go import path](https://github.com/golang/go/wiki/SettingGOPATH). See also: https://stackoverflow.com/a/57953217/658497 – Noam Manos Sep 16 '19 at 09:52

1 Answers1

4

From that goji issue 13, the right command is:

go get goji.io

That page http://goji.io/ has the go-import meta directive:

<meta name="go-import" content="goji.io git https://github.com/goji/goji">

That way, go does not consider goji.io/internal (see for instance router.go) as trying to import internal package of a "third-party".
This issue illustrates the wrong internal import case:

You are not allowed to import internal package (or its subpackages) of a third party repo.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250