使用go get github.com/go-sql-driver/mysql下载go-mysql驱动报错了,如下:

AI了一下,原来在Go 1.16 及以上版本版本,go get只能在被 go mod init 初始化的目录里面使用了。
如果想要全局安装使用 go install github.com/go-sql-driver/mysql@latest,必须指定版本
默认是安装在 GOPATH\pkg\mod\
使用go get github.com/go-sql-driver/mysql下载go-mysql驱动报错了,如下:

AI了一下,原来在Go 1.16 及以上版本版本,go get只能在被 go mod init 初始化的目录里面使用了。
如果想要全局安装使用 go install github.com/go-sql-driver/mysql@latest,必须指定版本
默认是安装在 GOPATH\pkg\mod\