Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find version of a module

We are working with Go modules. I want in a CLI to get the specific version of a module. Is it possible?

If you are curious, the reason is that I want to add the following generate command:

//go:generate go run github.com/golang/mock/mockgen -source="$GOPATH/pkg/mod/mymodules.com/mymodule@${VERSION}/module.go" -destination=module_mock.go

So I need to somehow get the version

like image 964
ElyashivLavi Avatar asked Dec 05 '19 13:12

ElyashivLavi


1 Answers

Late but worth to mention, if you want to check the all available versions of a specific module:

go list -m -versions <module_name>

Like:

go list -m -versions github.com/user/module-name

like image 50
Zubair Hassan Avatar answered Oct 01 '22 20:10

Zubair Hassan