我是Go的新手,当我构建我的项目时,它返回了以下错误:
/usr/local/go/bin/go run /home/qiuwei/GoWorkSpace/src/LearnGo/SoHi/Hello.go
# runtime
/usr/local/go/src/runtime/lfstack_amd64.go:16: lfstackPack redeclared in this block
previous declaration at /usr/local/go/src/runtime/lfstack_64bit.go:37
/usr/local/go/src/runtime/lfstack_amd64.go:20: lfstackUnpack redeclared in this block
previous declaration at /usr/local/go/src/runtime/lfstack_64bit.go:41
/usr/local/go/src/runtime/os_linux_generic.go:13: _SS_DISABLE redeclared in this block
previous declaration at /usr/local/go/src/runtime/os2_linux_generic.go:12
/usr/local/go/src/runtime/os_linux_generic.go:14: _NSIG redeclared in this block
previous declaration at /usr/local/go/src/runtime/os2_linux_generic.go:13
/usr/local/go/src/runtime/os_linux_generic.go:15: _SI_USER redeclared in this block
previous declaration at /usr/local/go/src/runtime/os2_linux_generic.go:14
/usr/local/go/src/runtime/os_linux_generic.go:16: _SIG_BLOCK redeclared in this block
previous declaration at /usr/local/go/src/runtime/os2_linux_generic.go:15
/usr/local/go/src/runtime/os_linux_generic.go:17: _SIG_UNBLOCK redeclared in this block
previous declaration at /usr/local/go/src/runtime/os2_linux_generic.go:16
/usr/local/go/src/runtime/os_linux_generic.go:18: _SIG_SETMASK redeclared in this block
previous declaration at /usr/local/go/src/runtime/os2_linux_generic.go:17
/usr/local/go/src/runtime/os_linux_generic.go:19: _RLIMIT_AS redeclared in this block
previous declaration at /usr/local/go/src/runtime/os2_linux_generic.go:18
/usr/local/go/src/runtime/os_linux_generic.go:25: sigset redeclared in this block
previous declaration at /usr/local/go/src/runtime/os2_linux_generic.go:24
/usr/local/go/src/runtime/os_linux_generic.go:25: too many errors
字符串
显示我的go env:
export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME/GoWorkSpace
型
Go版本:go1.6.3
。操作系统:Ubuntu 14.04
怎么修?
3条答案
按热度按时间mzsu5hc01#
删除所有解压缩的文件并再次解压缩1.6 tar。如果您仍然看到该问题,您也可以尝试重新启动您的终端。
字符串
有关详细信息,请访问see this
wn9m85ua2#
在使用Go 1.18时也会看到这个错误,如reddit thread所示。
我通过删除先前存在的1.17安装解决了我的问题;请尝试清除/usr/local/go文件夹,然后再次解压缩1. 18 tar包。
我的猜测是,一些源文件的名称发生了变化(或者类似的事情),这意味着在原地对1.18进行解压缩会导致这些重新声明错误。
如issue 47773所示。
这就是为什么Windows安装程序,安装,开始 * 卸载 * Go 1.17,然后再安装1.18.
rsaldnfx3#
执行以下操作: