我尝试在 golang 中连接到 SQL 服务器,我在互联网上搜索并通过这个地址:https://github.com/denisenkom/go-mssqldb我知道首先我需要为此目的安装一个包,但是当我想通过输入以下命令通过 git 终端安装这个包时:
$ 去获取 github.com/denisenkom/go-mssqldb
我收到这个错误:
无法加载包:github.com/denisenkom/go-mssqldb 包:C:\Go\src\github.com\dnisenkom\go-mssqldb 中没有可构建的 go 源文件
我的 $GOPATH 已经设置好了。我不知道如何解决这个问题......
最佳答案
根据golang网站:
Get downloads and installs the packages named by the import paths, along with their dependencies.
听起来好像下载不工作,这导致文件夹为空。一种替代方法是将驱动程序下载为 zip 文件并在该文件夹上运行 go install。
关于sql - 如何在golang中安装包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31794172/