英文:
import object is expected between different go versions
问题
我从go 1.6切换到1.4.2以加快编译速度。当我重新编译之前使用1.6编译的二进制文件时,出现以下错误:
import go/pkg/darwin_amd64/github.com/Sirupsen/logrus.a: object is
[darwin amd64 go1.6 X:none] expected [darwin amd64 go1.4.2 X:precisestack]
我已经尝试过go build -a
,没有出现任何错误。我还尝试过go install -a
和go build
,这两个命令都会抛出上述错误。
我已经知道,如果我删除go/pkg
文件夹,问题就会解决。这是已存在的SO问题的答案。
我想知道,是否有其他使用go工具解决这个问题的方法,而不是删除pkg
文件夹。
英文:
I switched from go 1.6 to 1.4.2 for faster compilation. When I recompile the earlier compiled binary of 1.6, I get the following error:
import go/pkg/darwin_amd64/github.com/Sirupsen/logrus.a: object is
[darwin amd64 go1.6 X:none] expected [darwin amd64 go1.4.2 X:precisestack]
I have already tried go build -a
- which works without any error. And have also tried go install -a
and go build
- both of these commands throw the above mentioned error.
I already know that, if I delete by go/pkg
folder, then it will work. That is the answer of the already existing SO question
I wanted to know, if there is another way to resolve this using go tools, other than deleting the pkg
folder.
答案1
得分: 3
很可能是由于之前的编译导致的。只需删除你的$GOLANG/pkg文件夹,然后就可以继续了!
> 解决这个问题的另一种方法是使用go工具,而不是删除pkg文件夹。
go工具链不太可能被修改来处理这种特殊情况。
英文:
Most likely due to previous compiles. Just delete your $GOLANG/pkg and you are good to go!
> another way to resolve this using go tools, other than deleting the pkg folder.
The go tool chain is unlikely to be modified to handle this corner use case.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论