最近转到 go 开发,编辑器还是用的 vim 配合 ycm,之前写 py 一直没问题,但是现在写 go,ycm 就不正常了,体现在标准库可以正常提示,第三方的就不行,自定义包有时可以有时不可以。 我是用的 glide,第三方包都是在项目的 vendor 下,我看了 gocode,已经支持 vendor 目录了,是不是 ycm 的 gocode 还是旧版的缘故?看 gocode 是提示找不到库,所以不能提示
附上 ycm 的日志:
Printing YouCompleteMe debug information...
-- Client logfile: /var/folders/n9/3xkfkvg14hg1y5s6gb0rt2hm0000gn/T/ycm_V4rMdM.log
-- Server Python interpreter: /usr/bin/python
-- Server Python version: 2.7.10
-- Server has Clang support compiled in: True
-- Clang version: clang version 6.0.0 (tags/RELEASE_600/final)
-- Extra configuration file found and loaded
-- Extra configuration path: /Users/noisyguy/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py
-- Go completer debug information:
-- Gocode running at: http://127.0.0.1:56711
-- Gocode process ID: 8520
-- Gocode executable: /Users/noisyguy/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/gocode/gocode
-- Gocode logfiles:
-- /var/folders/n9/3xkfkvg14hg1y5s6gb0rt2hm0000gn/T/gocode_56711_stdout_iv8Bgf.log
-- /var/folders/n9/3xkfkvg14hg1y5s6gb0rt2hm0000gn/T/gocode_56711_stderr_ieYfnG.log
-- Godef executable: /Users/noisyguy/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/godef/godef
-- Server running at: http://127.0.0.1:56707
-- Server process ID: 8389
-- Server logfiles:
-- /var/folders/n9/3xkfkvg14hg1y5s6gb0rt2hm0000gn/T/ycmd_56707_stdout_cGL9ys.log
-- /var/folders/n9/3xkfkvg14hg1y5s6gb0rt2hm0000gn/T/ycmd_56707_stderr_Bqz6zK.log
gocode 日志:
696975 2018/04/07 21:43:02 Import path "github.com/json-iterator/go" was not resolved
696976 2018/04/07 21:43:02 Gocode's build context is:
696977 2018/04/07 21:43:02 GOROOT: /usr/local/go
696978 2018/04/07 21:43:02 GOPATH: /Users/noisyguy/go
696979 2018/04/07 21:43:02 GOOS: darwin
696980 2018/04/07 21:43:02 GOARCH: amd64
696981 2018/04/07 21:43:02 BzlProjectRoot: ""
696982 2018/04/07 21:43:02 GBProjectRoot: ""
696983 2018/04/07 21:43:02 lib-path: ""
696984 2018/04/07 21:43:02 Import path "github.com/PuerkitoBio/goquery" was not resolved
696985 2018/04/07 21:43:02 Gocode's build context is:
696986 2018/04/07 21:43:02 GOROOT: /usr/local/go
696987 2018/04/07 21:43:02 GOPATH: /Users/noisyguy/go
696988 2018/04/07 21:43:02 GOOS: darwin
696989 2018/04/07 21:43:02 GOARCH: amd64
696990 2018/04/07 21:43:02 BzlProjectRoot: ""
696991 2018/04/07 21:43:02 GBProjectRoot: ""
696992 2018/04/07 21:43:02 lib-path: ""
696993 2018/04/07 21:43:02 Error parsing input file (inner block):
696994 2018/04/07 21:43:02 160:72: expected selector or type assertion, found ';'
696995 2018/04/07 21:43:02 160:73: missing ',' in argument list
696996 2018/04/07 21:43:02 160:78: expected operand, found ')'
696997 2018/04/07 21:43:02 164:9: expected ')', found 'return'
696998 2018/04/07 21:43:02 164:16: missing ',' in argument list
696999 2018/04/07 21:43:02 164:19: expected operand, found ','
697000 2018/04/07 21:43:02 166:5: missing ',' in argument list
697001 2018/04/07 21:43:02 166:14: missing ',' in argument list
697002 2018/04/07 21:43:02 166:17: expected operand, found 'range'
697003 2018/04/07 21:43:02 170:5: missing ',' in argument list
697004 2018/04/07 21:43:02 170:20: missing ',' before newline in argument list
697005 2018/04/07 21:43:02 171:1: expected operand, found '}'
697006 2018/04/07 21:43:02 171:2: expected ')', found 'EOF'
697007 2018/04/07 21:43:02 171:2: expected ';', found 'EOF'
697008 2018/04/07 21:43:02 171:2: expected ';', found 'EOF'
697009 2018/04/07 21:43:02 171:2: expected ';', found 'EOF'
697010 2018/04/07 21:43:02 171:2: expected '{', found 'EOF'
697011 2018/04/07 21:43:02 171:2: expected '}', found 'EOF'
697012 2018/04/07 21:43:02 171:2: expected '}', found 'EOF'
697013 2018/04/07 21:43:02 171:2: expected '}', found 'EOF'
697014 2018/04/07 21:43:02 171:2: missing ',' in argument list
697015 2018/04/07 21:43:02 extracted expression tokens: titleTag.First()
697016 2018/04/07 21:43:02 Offset: 0
697017 2018/04/07 21:43:02 Number of candidates found: 0
697018 2018/04/07 21:43:02 Candidates are:
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.