Maxim Yefremov
Maxim Yefremov

Reputation: 14165

import object is expected Error in Golang 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.

Upvotes: 13

Views: 3080

Answers (2)

OneOfOne
OneOfOne

Reputation: 99195

Just delete the old pkg files, usually it upgrades automatically though.

rm -rf $GOPATH/pkg/

Upvotes: 32

raven
raven

Reputation: 188

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

Upvotes: 5

Related Questions