mock icon indicating copy to clipboard operation
mock copied to clipboard

Create guides on migrating from golang/mock to go.uber.org/mock

Open sywhang opened this issue 2 years ago • 3 comments

sywhang avatar Jun 01 '23 21:06 sywhang

I, for one, would really appreciate this. I tried using a replace directive in go.mod:

replace github.com/golang/mock => go.uber.org/mock v0.2.0

but it didn't work:

$ go mod tidy
...
go: go.uber.org/[email protected] used for two different module paths (github.com/golang/mock and go.uber.org/mock)

Is there an easy way, or do I simply have to change the import path in every Go file?

barrettj12 avatar Jul 11 '23 21:07 barrettj12

@barrettj12 it is a bit weird when switching because of the present github.com/golang/mock dependency. But Find+Replace with github.com/golang/mock -> go.uber.org/mock/gomock and mod tidy-ing should do the job

pavleprica avatar Jul 16 '23 18:07 pavleprica

I believe this https://github.com/uber-go/mock/issues/51 issue would also block the migration as it might conflict with upstream package's import.

bcho avatar Aug 04 '23 10:08 bcho