Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module declares its path as: github.com/jinzhu/gorm but was required as: gorm.io/gorm #3038

Closed
LonglyCode opened this issue Jun 7, 2020 · 6 comments

Comments

@LonglyCode
Copy link

Your issue may already be reported! Please search on the issue track before creating one.

What version of Go are you using (go version)?

go1.13

Which database and its version are you using?

Mysql 5.7

Please provide a complete runnable program to reproduce your issue. IMPORTANT

Need to runnable with GORM's docker compose config or please provides your config.

package main

import (
	"fmt"

	"gorm.io/driver/mysql"
	"gorm.io/gorm"
)

var GDB *gorm.DB

func main() {
	var err error
	dsn := "gorm:gorm@tcp(localhost:9910)/gorm?charset=utf8&parseTime=True&loc=Local"
	GDB, err = gorm.Open(mysql.Open(dsn), &gorm.Config{})
	if err != nil {
		fmt.Println("open db err", err)
	}
}
@LonglyCode
Copy link
Author

Run go build,will get error:

go: finding gorm.io/driver/mysql latest
go: gotest imports
	gorm.io/driver/mysql imports
	gorm.io/gorm: gorm.io/gorm@v1.9.12: parsing go.mod:
	module declares its path as: github.com/jinzhu/gorm
	        but was required as: gorm.io/gorm

@jinzhu
Copy link
Member

jinzhu commented Jun 7, 2020

I am working on that, please use go get gorm.io/gorm@v0.2.4 to install for now.

@github-actions
Copy link

github-actions bot commented Jul 9, 2020

This issue will be automatically closed because it is marked as GORM V1 issue, we have released the public testing GORM V2 release and its documents https://v2.gorm.io/docs/ already, the testing release has been used in some production services for a while, and going to release the final version in following weeks, we are still actively collecting feedback before it, please open a new issue for any suggestion or problem, thank you

Also check out https://github.com/go-gorm/gorm/wiki/GORM-V2-Release-Note-Draft for how to use the public testing version and its changelog

@741369
Copy link

741369 commented Jul 16, 2020

go get github.com/jinzhu/gorm@v2_dev

go get github.com/jinzhu/gorm@v2_dev
v2 will get error
go: github.com/jinzhu/gorm v2_dev => v1.9.13-0.20200602011801-e986371a42bb
go get: github.com/jinzhu/gorm@v1.9.13-0.20200602011801-e986371a42bb: parsing go.mod:
module declares its path as: gorm.io/gorm
but was required as: github.com/jinzhu/gorm

@ifqygazhar
Copy link

how to fix this ?

github.com/go-gorm/mysql@none updating to
github.com/go-gorm/mysql@v1.1.1: parsing go.mod:
module declares its path as: gorm.io/driver/mysql
but was required as: github.com/go-gorm/mysql

@runzhliu
Copy link

@ifqygazhar it does work for me ;)

module test

go 1.18

require (
	gorm.io/driver/sqlite v1.2.6
	gorm.io/gorm v1.22.4
)

require (
	github.com/jinzhu/inflection v1.0.0 // indirect
	github.com/jinzhu/now v1.1.3 // indirect
	github.com/mattn/go-sqlite3 v1.14.9 // indirect
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants