在不同的Go版本之间,期望导入对象。

huangapple go评论80阅读模式
英文:

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 -ago 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.

huangapple
  • 本文由 发表于 2016年4月3日 02:01:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/36376934.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定