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.:

github.com/aws/aws-lambda-runtime-interface-emulator/cmd/aws-lambda-rie

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

go: github.com/aws/aws-lambda-runtime-interface-emulator/cmd/aws-lambda-rie@latest: version constraints conflict:
	github.com/aws/aws-lambda-runtime-interface-emulator@v0.0.0-20230608002416-bf7e24860347: parsing go.mod:
	module declares its path as: go.amzn.com
	        but was required as: github.com/aws/aws-lambda-runtime-interface-emulator

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 github.com/aws/aws-lambda-runtime-interface-emulator@latest

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.