先运行这一行代码 go mod init main.go 再运行你的go get命令就好了。 参考:https://blog.csdn.net/sepnineth/article/details/125153354