编译go代码提示“\src\runtime\map.go:65:2: bucketCntBits redeclared in this block”问题解决

问题说明

2016年末接触了golang语言,而且一开始折腾了一段时间,奈何也是三天打鱼两天晒网的兴致。后面再拾起来,已经是2019年,IT行业早已经变了天。下载了go1.12.4.windows-amd64.msi进行安装后,简单的进行了编译,发现提示如下的错误:

# runtime
E:\Go\src\runtime\map.go:64:2: bucketCntBits redeclared in this block
        previous declaration at E:\Go\src\runtime\hashmap.go:64:18
E:\Go\src\runtime\map.go:65:2: bucketCnt redeclared in this block
        previous declaration at E:\Go\src\runtime\hashmap.go:65:23
E:\Go\src\runtime\map.go:76:2: maxKeySize redeclared in this block
        previous declaration at E:\Go\src\runtime\hashmap.go:74:17
E:\Go\src\runtime\map.go:77:2: maxValueSize redeclared in this block
        previous declaration at E:\Go\src\runtime\hashmap.go:75:17
E:\Go\src\runtime\map.go:82:2: dataOffset redeclared in this block
        previous declaration at E:\Go\src\runtime\hashmap.go:83:4
E:\Go\src\runtime\map.go:91:2: empty redeclared in this block
        previous declaration at E:\Go\src\runtime\hashmap.go:89:19
E:\Go\src\runtime\map.go:92:2: evacuatedEmpty redeclared in this block
        previous declaration at E:\Go\src\runtime\hashmap.go:90:19
E:\Go\src\runtime\map.go:93:2: evacuatedX redeclared in this block
        previous declaration at E:\Go\src\runtime\hashmap.go:91:19
E:\Go\src\runtime\map.go:94:2: evacuatedY redeclared in this block
        previous declaration at E:\Go\src\runtime\hashmap.go:92:19
E:\Go\src\runtime\map.go:95:2: minTopHash redeclared in this block
        previous declaration at E:\Go\src\runtime\hashmap.go:93:19
E:\Go\src\runtime\map.go:95:2: too many errors

问题分析

如上图所示再google上面搜索了一下,找到了如下的链接https://github.com/golang/go/issues/27269。里面有下面的描述:
在这里插入图片描述
说是因为安装了两个版本造成覆盖问题所导致,卸载后重新安装即可。
回忆起可能以前真的再d盘装过golang,后面重新安装可能选择的是同一个路径导致。

解决方案

根据上面的提示,重新卸载安装就可以解决问题了,我这边重新卸载安装后终于能正确的编译出hello,world了。
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值