Using go install with a module not named after the required path

So far I’m been installing this module manually (git clone && cd && go build), but I’ll like to use go install, however I’m having trouble doing so, due to the name that the package author decided to use for their module.

I’m trying to to install this module.:

However when I try to use go install, go install complains because the go.mod there is named, more precisely the error go install generates is the following:

go: version constraints conflict: parsing go.mod:
	module declares its path as:
	        but was required as:

I thought ok so for sure I can use a .mod to indicate a rename, but If I do that, go install complains differently.

go: -modfile cannot be used with commands that ignore the current module

Is there any easy way to build out tools/modules that use configuration that is not go install friendly? So I don’t need to clone && cd and && build myself?

In this particular path, there is no go.mod-file:

There is just one go.mod-file for the entire project.
This makes me believe this repository was never intended to directly install from.

The author probably just used the cmd-directory without really following this (unwritten?) convention that you should preferably only use the cmd-directory for installable commands. But AFAIK in this case there is always a separate go.mod-file.

You might try installing with the main link:

go get

But I doubt installing like this was intended behaviour.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.