英文:
import object is expected Error in Golang 1.4.2
问题
我刚刚将Golang从1.3
升级到版本1.4.2
。但是由于以下错误,无法编译:
../../my/mandrill.go:5: import /path/to/go/home/pkg/darwin_amd64/github.com/keighl/mandrill.a: object is [darwin amd64 go1.3.3 X:precisestack] expected [darwin amd64 go1.4.2 X:precisestack]
FAIL folder [build failed]
在第m "github.com/keighl/mandrill"
行上。
package my
import (
"fmt"
m "github.com/keighl/mandrill"
)
我猜测在1.4.2
中导入的一些规则已经改变了。但是我无法弄清楚如何更改我的导入代码以使其编译通过。
英文:
I have just upgraded Golang from 1.3
to version 1.4.2
. And cannot compile due to error:
../../my/mandrill.go:5: import /path/to/go/home/pkg/darwin_amd64/github.com/keighl/mandrill.a: object is [darwin amd64 go1.3.3 X:precisestack] expected [darwin amd64 go1.4.2 X:precisestack]
FAIL folder [build failed]
on line m "github.com/keighl/mandrill"
package my
import (
"fmt"
m "github.com/keighl/mandrill"
)
I guess some rules of importing have changed in 1.4.2
. But cannot figure out how to change my import code to make it compile.
答案1
得分: 32
只需删除旧的 pkg 文件,通常它会自动升级。
rm -rf $GOPATH/pkg/
英文:
Just delete the old pkg files, usually it upgrades automatically though.
rm -rf $GOPATH/pkg/
答案2
得分: 5
我也遇到了这个问题。我删除了旧的软件包,但仍然出现相同的错误。最后我发现旧的软件包仍然被我的“sublime text2”生成。重新启动后,一切都恢复正常了 :p
英文:
I met this problem too. I deleted the old packages but still get same error. finally I found the old pkg keep get generated by my "sublime text2". after restarted it. everything back to work :p
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论