在Golang 1.4.2中,预计会出现”import object is expected”错误。

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

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

huangapple
  • 本文由 发表于 2015年3月9日 10:59:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/28934618.html
匿名

发表评论

匿名网友

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

确定