DATA-DOG / go-sqlmock

Sql mock driver for golang to test database interactions
Other
6.06k stars 408 forks source link

v1.3.1 Breaks build #161

Closed KillerX closed 5 years ago

KillerX commented 5 years ago

Any idea what is going on here? This has been happening for us since the 1.3.1 release.

go: finding gopkg.in/DATA-DOG/go-sqlmock.v1 v1.3.1
go: gopkg.in/DATA-DOG/go-sqlmock.v1@v1.3.1: go.mod has non-....v1 module path "sqlmock" at revision v1.3.1
l3pp4rd commented 5 years ago

Hi, most likely something is not right with the module name

jrbarron commented 5 years ago

I think the module name in go.mod is incorrect. The following change fixes it for me:

-module sqlmock
+module gopkg.in/DATA-DOG/go-sqlmock.v1
l3pp4rd commented 5 years ago

is it a good practice to have a gopkg.in/DATA-DOG/go-sqlmock.v1 gopkg module name? or it should rather be github.com/DATA-DOG/go-sqlmock since modules support versioning

philtay commented 5 years ago

Initialize go.mod with:

$ go mod init github.com/DATA-DOG/go-sqlmock

You don't need gopkg.in at all.

l3pp4rd commented 5 years ago

created the v1.3.2 tag, hope that will not cause any more issues

philtay commented 5 years ago

@l3pp4rd you can now start to migrate away from gopkg.in (if you want). i mean docs, examples, etc...

l3pp4rd commented 5 years ago

@philtay would you be kind to create a pull request?

philtay commented 5 years ago

@l3pp4rd I can't right now, but the commands below should be enough:

$ sed -i 's/gopkg.in\/DATA-DOG\/go-sqlmock.v1/github.com\/DATA-DOG\/go-sqlmock/g' <files ... e.g. README.md>
$ git commit -a -m "Hello SemVer!"
$ git push
smadbe commented 5 years ago

Seems to work, do not forget to fix the README as well to use github.com/DATA-DOG/go-sqlmock (go get and import (...)).

dolmen commented 5 years ago

Thanks for breaking all our go.mod files and imports. 😭

dolmen commented 5 years ago

On Mac, here is the fixed sed command to change import path:

$ sed -i '' 's/gopkg.in\/DATA-DOG\/go-sqlmock.v1/github.com\/DATA-DOG\/go-sqlmock/g' *.go
philtay commented 5 years ago

@dolmen You're welcome!