gogo-modules

Go install, but repo and module declared are not a match


I was given access to a private repo on Github that is actually some cli tool written in Golang. I tried installing it like this:

go install github.com/company-x/afctl@latest

Which resulted in an error:

github.com/company-x/afctl@v1.0.0: parsing go.mod:
module declares its path as: company-y.io/afctl
        but was required as: github.com/company-x/afctl

Which is expected because module is declared as

module company-y.io/afctl

go 1.14
…

I presume they used to host the repo some place else before moving it to Github. I guess there’s no way then to install it using ‘go install’? They’re probably not going to let me tinker with their source code. I just want to make sure I haven't missed something.


Solution

  • You could try go install company-y.io/afctl@latest, when https://company-y.io/afctl is reachable.

    Otherwise do

    git clone -b v1.0.0 https://github.com/company-x/afctl.git
    cd afctl
    go install .