Closed deadok22 closed 5 years ago
@deadok22
Can you please provide more details like Go version and maybe some dummy project for me to be able to reproduce it.
Also, what option do you think is the best? Since 2.x is already broken I'm thinking of:
module github.com/gojuno/minimock/v3
to go.mod filegithub.com/gojuno/minimock/v3
Steps to reproduce:
sergey@sergey:/tmp$ go version
go version go1.11.4 linux/amd64
sergey@sergey:/tmp$ mkdir minimockv && cd minimockv
sergey@sergey:/tmp/minimockv$ export GO111MODULES=on
sergey@sergey:/tmp/minimockv$ go mod init example.com/minimockv/minimockv
go: creating new go.mod: module example.com/minimockv/minimockv
sergey@sergey:/tmp/minimockv$ go get github.com/gojuno/minimock
go: finding github.com/gojuno/minimock latest
go: downloading github.com/gojuno/minimock v0.0.0-20190617160801-48589a7befe5
sergey@sergey:/tmp/minimockv$ cat go.mod
module example.com/minimockv/minimockv
require github.com/gojuno/minimock v0.0.0-20190617160801-48589a7befe5 // indirect
When the issue is fixed go.mod
will contain an actual version, not a pseudo-version.
The approach you're thinking of seems reasonable and should work.
@deadok22 please check if everything is ok with v3
Also be aware that now minimock puts new import path to the generated code: github.com/gojuno/minimock/v3
Thanks @hexdigest! Works as expected!
Upgrade instructions:
$ go get github.com/gojuno/minimock/v3@v3.0.0
//go:generate go run github.com/gojuno/minimock/cmd/minimock
strings with //go:generate go run github.com/gojuno/minimock/v3/cmd/minimock
github.com/gojuno/minimock/cmd/minimock
imports with imports of github.com/gojuno/minimock/v3/cmd/minimock
go generate
the affected filesgo mod tidy
The latest version (
v2.1.5
) causesgo list
and some other tools to fail:Using one of the approaches suggested in Releasing Modules (v2 or Higher) would resolve this.
Workaround: depend on
minimock
using pseudo-versions as if it is not a proper go module. See this doc for details.