Hi Nges,

On Thu, Mar 03, 2016 at 03:26:26AM +0100, Nges B wrote:
[...]
> after running
>    $  go get git-wip-us.apache.org/repos/asf/incubator-mynewt-newt.git/newt
> 
> I get the following error.
> 
> package git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/newt/cli:
> unrecognized import path
> "git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/newt/cli"

Unfortunately the "go get" command seems to have problems with the
git-wip-us.apache.org git server.  I will add some details at the end of
this email if you are interested, but first, here is a workaround.

Download the newt sources with git and install manually:

    # cd "$GOPATH"
    # mkdir -p src/git-wip-us.apache.org/repos/asf
    # cd src/git-wip-us.apache.org/repos/asf
    # git clone https://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt
    # cd incubator-mynewt-newt/newt
    # go get
    # go install

The above procedure should result in the "newt" binary being installed
to your go bin directory ($GOPATH/bin).  If you have added this
directory to your path, you can execute newt from anyway.

Below is my understanding of the cause of the "unrecognized import path"
issue.  It's a little confusing, so my thoughts might be a bit jumbled.

The reason for the "unrecognized import path" error has to do with the
".git" extension in the mynewt git URL.  The "go get" command creates a
directory tree exactly as specified, and then downloads the package.
The newt source files do not expect the ".git" extension to be present
in the directory tree, so compilation fails when these file try to
import code from a nonexistent directory.

If you clone a git repository manually, git never includes the ".git"
suffix in the new directory, even if you specify it as part of the URL.

Different git servers seem to have different requirements with respect
to the ".git" suffix.  github, for example, seems to reject a "go get"
operation that specifies a URL that includes the suffix.  If you leave
the suffix off, the package is successfully downloaded from github and
placed in a suffix-free directory.

When pointed at the apache server, on the other hand, "go get" seems to
require the ".git" suffix.  An I mentioned earlier, this results in the
creation of a directory that also has the ".git" suffix.

The problem is: the behavior of "git clone" is in conflict with the
behavior of "go get", at least with regards to the apache git server.
At one point the installation documentation was accurate, but it seems
we have since opted for git-friendliness rather than
go-get-friendliness.

We will need to find a simpler workaround.  In the meantime, we should
at least update the documentation.  Also, soon newt binaries will be
available for download which help to alleviate problems with go.

Thanks,
Chris

Reply via email to