Home  >  Article  >  Backend Development  >  Why Am I Getting \"import object is expected\" Error After Upgrading Golang to 1.4.2?

Why Am I Getting \"import object is expected\" Error After Upgrading Golang to 1.4.2?

Barbara Streisand
Barbara StreisandOriginal
2024-11-02 07:56:02639browse

Why Am I Getting

Fix "import object is expected Error" in Golang 1.4.2

Upon upgrading Golang from 1.3 to 1.4.2, encountering an import issue:

../../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]

This error occurs due to potential changes in import rules in Golang 1.4.2.

Solution:

The issue arises from outdated pkg files. To resolve it, delete these files:

rm -rf $GOPATH/pkg/

Typically, these files are upgraded automatically, but manually deleting them ensures the updated version is used during compilation.

The above is the detailed content of Why Am I Getting \"import object is expected\" Error After Upgrading Golang to 1.4.2?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn