Idea golang "can’t find import" 解决方法

如题,在使用leveldb go wrapper levigo 的时候,本地安装好levigo后,通过命令行编译代码正常并能work,但在Idea中使用时出现:

can't find import "github.com/jmhodges/levigo"

参考 https://github.com/mtoader/google-go-lang-idea-plugin/issues/159

我是这么解决的:分别创建源码和.a文件所在目录的软连接:

其中 /home/fun/software/go/go/

fun@fun:~$ echo $GOROOT
/home/fun/software/go/go

 

软链接:

  /home/fun/software/go/go/pkg/linux_amd64/github.com -> /home/fun/software/go/go/bin/pkg/linux_amd64/github.com/ 

/home/fun/software/go/go/src/pkg/github.com -> /home/fun/software/go/go/bin/src/github.com/

文件结构:

tree /home/fun/software/go/go/pkg/linux_amd64/github.com
/home/fun/software/go/go/pkg/linux_amd64/github.com
└── jmhodges
└── levigo.a

 

tree /home/fun/software/go/go/src/pkg/github.com
/home/fun/software/go/go/src/pkg/github.com
├── jmhodges
│   └── levigo
│   ├── batch.go
│   ├── cache.go
│   ├── comparator.go
│   ├── conv.go
│   ├── db.go
│   ├── doc.go
│   ├── env.go
│   ├── examples
│   │   └── comparator_example.go
│   ├── filterpolicy.go
│   ├── iterator.go
│   ├── leveldb_test.go
│   ├── LICENSE
│   ├── options.go
│   └── README.md
└── nsf
└── gocode
├── autocompletecontext.go
├── autocompletefile.go

..........

 

 

  

 

posted @ 2013-08-24 15:11  AndreMouche  阅读(996)  评论(0编辑  收藏  举报