GoLang错误合集

1: go 编译过程出现文件不存在错误

/usr/local/go/pkg/tool/linux_amd64/link: cannot open file /usr/local/go/pkg/linux_amd64/github.com/spf13/cobra.a: open /usr/local/go/pkg/linux_amd64/github.com/spf13/cobra.a: no such file or directory
解决方案: 
go build -pkgdir /home/marczahn/go/pkg/ -o main main.go
2:
Get www.google.com: unsupported protocol scheme ""

解决方案:

添加运行参数时候,需要对对应的url带上例如: http://www.google.com or https://www.google.com

3:

exec: "gcc": executable file not found in %PATH%

解决方案:

下载mingw64;https://sourceforge.net/projects/mingw-w64/;并配置相应的环境变量

4:

src\github.com\ethereum\go-ethereum\cmd\geth\main.go:152:3: undefined: initCommand
src\github.com\ethereum\go-ethereum\cmd\geth\main.go:153:3: undefined: importCommand
src\github.com\ethereum\go-ethereum\cmd\geth\main.go:154:3: undefined: exportCommand
src\github.com\ethereum\go-ethereum\cmd\geth\main.go:155:3: undefined: importPreimagesCommand
src\github.com\ethereum\go-ethereum\cmd\geth\main.go:156:3: undefined: exportPreimagesCommand
src\github.com\ethereum\go-ethereum\cmd\geth\main.go:157:3: undefined: copydbCommand
src\github.com\ethereum\go-ethereum\cmd\geth\main.go:158:3: undefined: removedbCommand
src\github.com\ethereum\go-ethereum\cmd\geth\main.go:159:3: undefined: dumpCommand
src\github.com\ethereum\go-ethereum\cmd\geth\main.go:161:3: undefined: accountCommand
src\github.com\ethereum\go-ethereum\cmd\geth\main.go:161:3: too many errors

解决方案:

run -> Edit Configurations -> Run kind 中将类型file改成package

5: go get无法安装google.golang.org等相关依赖包

git clone https://github.com/grpc/grpc-go.git $GOPATH/src/google.golang.org/grpc
git clone https://github.com/golang/net.git $GOPATH/src/golang.org/x/net
git clone https://github.com/golang/text.git $GOPATH/src/golang.org/x/text

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值