编译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。里面有下面的描述:
编译go代码提示“\src\runtime\map.go:65:2: bucketCntBits redeclared in this block”问题解决_第1张图片
说是因为安装了两个版本造成覆盖问题所导致,卸载后重新安装即可。
回忆起可能以前真的再d盘装过golang,后面重新安装可能选择的是同一个路径导致。

解决方案

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

你可能感兴趣的:(Golang)