golang / mock

GoMock is a mocking framework for the Go programming language.
Apache License 2.0
9.28k stars 610 forks source link

Updated README with correct information. #585

Closed Saurabh-Thakre closed 2 years ago

Saurabh-Thakre commented 2 years ago

go install doesn't with path@version and can only be used with go get syntax. Following is the error you get when you use go install github.com/golang/mock/mockgen@v1.6.0

package github.com/golang/mock/mockgen@latest: can only use path@version syntax with 'go get'

So removing @version

google-cla[bot] commented 2 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

googlebot commented 2 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

Saurabh-Thakre commented 2 years ago

@googlebot I signed it!

googlebot commented 2 years ago

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

google-cla[bot] commented 2 years ago

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

codyoss commented 2 years ago

Hey @Saurabh-Thakre thanks for the PR. I think this all depends on the version of Go you are using. Which version do you currently have installed out of curiosity? I believe with Go 1.17 the suggestion is to use the @version syntax when installing binaries. This way it can work both in and out of the context of a module.

Saurabh-Thakre commented 2 years ago

Hey @Saurabh-Thakre thanks for the PR. I think this all depends on the version of Go you are using. Which version do you currently have installed out of curiosity? I believe with Go 1.17 the suggestion is to use the @version syntax when installing binaries. This way it can work both in and out of the context of a module.

Hey @codyoss, ohh it depends on the Go version, I thought this at first. by the way, I'm on go version go1.15.8 linux/amd64. The following has got me confused somehow

Go 1.16+

does it make sense if we modify it like this. Just a suggestion for a better understanding

For Go Version > 1.16

codyoss commented 2 years ago

Does the provided command for your version of Go work for you? GO111MODULE=on go get github.com/golang/mock/mockgen@v1.6.0?

bradynpoulsen commented 2 years ago

For what it's worth, in Go 1.17, it might make sense to use the new module-aware go run syntax with versioning:

//go:generate go run github.com/golang/mock/mockgen@v1.6.0 -package ... -source ... -destination ...

We moved to that format since it made more sense to us to have a generic go generate ./... step in our CI/CD pipelines that didn't require us to do a go get for mockgen beforehand

Saurabh-Thakre commented 2 years ago

Does the provided command for your version of Go work for you? GO111MODULE=on go get github.com/golang/mock/mockgen@v1.6.0?

Yeah it works as expected !

codyoss commented 2 years ago

I am going to close this because I believe this is working as expected it seems.