当前位置:首页 > 文章列表 > Golang > Go问答 > VIM编译时遇到Go错误后的YouCompleteMe修正

VIM编译时遇到Go错误后的YouCompleteMe修正

来源:stackoverflow 2024-02-29 09:06:18 0浏览 收藏

大家好,我们又见面了啊~本文《VIM编译时遇到Go错误后的YouCompleteMe修正》的内容中将会涉及到等等。如果你正在学习Golang相关知识,欢迎关注我,以后会给大家带来更多Golang相关文章,希望我们能一起进步!下面就开始本文的正式内容~

问题内容

我是 vim 新手,我尝试使用 vimplug 安装 youcompleteme 插件...但是当我启动 python3 install.py --all 但之后,我收到此错误:

# golang.org/x/tools/internal/lsp/analysis/fillstruct
third_party/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/analysis/fillstruct/fillstruct.go:141:14: tok.linestart undefined (type *token.file has no field or method linestart)
third_party/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/analysis/fillstruct/fillstruct.go:170:15: tok.linestart undefined (type *token.file has no field or method linestart)
third_party/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/analysis/fillstruct/fillstruct.go:172:15: tok.linestart undefined (type *token.file has no field or method linestart)
# golang.org/x/tools/internal/jsonrpc2
third_party/go/pkg/mod/golang.org/x/[email protected]/internal/jsonrpc2/messages.go:171:5: undefined: errors.as
third_party/go/pkg/mod/golang.org/x/[email protected]/internal/jsonrpc2/serve.go:129:5: undefined: errors.is

我不知道这是什么意思? 有完整日志:

-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonLibs: /usr/lib/python3.7/config-3.7m-arm-linux-gnueabihf/libpython3.7.so (found suitable version "3.7.3", minimum required is "3.5") 
-- Using libclang archive: /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/cpp/../clang_archives/libclang-10.0.0-armv7a-linux-gnueabihf.tar.bz2
-- Using libclang to provide semantic completion for C/C++/ObjC
-- Using external libclang: /tmp/ycm_build_zcxr6q5l/lib/libclang.so.10
-- NOT using clang-tidy for static analysis.
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/ycm_build_zcxr6q5l
Scanning dependencies of target BoostParts
[  2%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/codecvt_error_category.cpp.o
[  5%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/directory.cpp.o
[  8%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/exception.cpp.o
[ 11%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/operations.cpp.o
[ 13%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/path.cpp.o
[ 16%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/path_traits.cpp.o
[ 19%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/portability.cpp.o
[ 22%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/unique_path.cpp.o
[ 25%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/utf8_codecvt_facet.cpp.o
[ 27%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/windows_file_codecvt.cpp.o
[ 30%] Linking CXX static library libBoostParts.a
[ 30%] Built target BoostParts
Scanning dependencies of target ycm_core
[ 33%] Building CXX object ycm/CMakeFiles/ycm_core.dir/Candidate.cpp.o
[ 36%] Building CXX object ycm/CMakeFiles/ycm_core.dir/CandidateRepository.cpp.o
[ 38%] Building CXX object ycm/CMakeFiles/ycm_core.dir/Character.cpp.o
[ 41%] Building CXX object ycm/CMakeFiles/ycm_core.dir/CharacterRepository.cpp.o
[ 44%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/ClangCompleter.cpp.o
[ 47%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/ClangHelpers.cpp.o
[ 50%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/ClangUtils.cpp.o
[ 52%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/CompilationDatabase.cpp.o
[ 55%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/CompletionData.cpp.o
[ 58%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/Documentation.cpp.o
[ 61%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/Range.cpp.o
[ 63%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/TranslationUnit.cpp.o
[ 66%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/TranslationUnitStore.cpp.o
[ 69%] Building CXX object ycm/CMakeFiles/ycm_core.dir/CodePoint.cpp.o
[ 72%] Building CXX object ycm/CMakeFiles/ycm_core.dir/CodePointRepository.cpp.o
[ 75%] Building CXX object ycm/CMakeFiles/ycm_core.dir/IdentifierCompleter.cpp.o
[ 77%] Building CXX object ycm/CMakeFiles/ycm_core.dir/IdentifierDatabase.cpp.o
[ 80%] Building CXX object ycm/CMakeFiles/ycm_core.dir/IdentifierUtils.cpp.o
[ 83%] Building CXX object ycm/CMakeFiles/ycm_core.dir/PythonSupport.cpp.o
[ 86%] Building CXX object ycm/CMakeFiles/ycm_core.dir/Result.cpp.o
[ 88%] Building CXX object ycm/CMakeFiles/ycm_core.dir/Utils.cpp.o
[ 91%] Building CXX object ycm/CMakeFiles/ycm_core.dir/Word.cpp.o
[ 94%] Building CXX object ycm/CMakeFiles/ycm_core.dir/versioning.cpp.o
[ 97%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ycm_core.cpp.o
[100%] Linking CXX shared library /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/ycm_core.so
[100%] Built target ycm_core
-- The C compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PythonLibs: /usr/lib/python3.7/config-3.7m-arm-linux-gnueabihf/libpython3.7.so (found version "3.7.3") 
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/regex_build_x5t1av6p
Scanning dependencies of target _regex
[ 33%] Building C object CMakeFiles/_regex.dir/regex_3/_regex.c.o
[ 66%] Building C object CMakeFiles/_regex.dir/regex_3/_regex_unicode.c.o
[100%] Linking C shared library /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/cregex/regex_3/_regex.so
[100%] Built target _regex
running build
running build_py
creating /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/watchdog_deps/watchdog/build/lib3
creating /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/watchdog_deps/watchdog/build/lib3/watchdog
copying src/watchdog/events.py -> /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/watchdog_deps/watchdog/build/lib3/watchdog
copying src/watchdog/watchmedo.py -> /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/watchdog_deps/watchdog/build/lib3/watchdog
copying src/watchdog/__init__.py -> /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/watchdog_deps/watchdog/build/lib3/watchdog
copying src/watchdog/version.py -> /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/watchdog_deps/watchdog/build/lib3/watchdog
creating /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/watchdog_deps/watchdog/build/lib3/watchdog/utils
copying src/watchdog/utils/compat.py -> /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/watchdog_deps/watchdog/build/lib3/watchdog/utils
copying src/watchdog/utils/win32stat.py -> /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/watchdog_deps/watchdog/build/lib3/watchdog/utils
copying src/watchdog/utils/dirsnapshot.py -> /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/watchdog_deps/watchdog/build/lib3/watchdog/utils
copying src/watchdog/utils/delayed_queue.py -> /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/watchdog_deps/watchdog/build/lib3/watchdog/utils
copying src/watchdog/utils/echo.py -> /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/watchdog_deps/watchdog/build/lib3/watchdog/utils
copying src/watchdog/utils/bricks.py -> /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/watchdog_deps/watchdog/build/lib3/watchdog/utils
copying src/watchdog/utils/unicode_paths.py -> /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/watchdog_deps/watchdog/build/lib3/watchdog/utils
copying src/watchdog/utils/__init__.py -> /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/watchdog_deps/watchdog/build/lib3/watchdog/utils
copying src/watchdog/utils/platform.py -> /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/watchdog_deps/watchdog/build/lib3/watchdog/utils
creating /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/watchdog_deps/watchdog/build/lib3/watchdog/tricks
copying src/watchdog/tricks/__init__.py -> /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/watchdog_deps/watchdog/build/lib3/watchdog/tricks
creating /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/watchdog_deps/watchdog/build/lib3/watchdog/observers
copying src/watchdog/observers/inotify_c.py -> /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/watchdog_deps/watchdog/build/lib3/watchdog/observers
copying src/watchdog/observers/inotify_buffer.py -> /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/watchdog_deps/watchdog/build/lib3/watchdog/observers
copying src/watchdog/observers/fsevents.py -> /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/watchdog_deps/watchdog/build/lib3/watchdog/observers
copying src/watchdog/observers/polling.py -> /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/watchdog_deps/watchdog/build/lib3/watchdog/observers
copying src/watchdog/observers/inotify.py -> /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/watchdog_deps/watchdog/build/lib3/watchdog/observers
copying src/watchdog/observers/api.py -> /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/watchdog_deps/watchdog/build/lib3/watchdog/observers
copying src/watchdog/observers/read_directory_changes.py -> /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/watchdog_deps/watchdog/build/lib3/watchdog/observers
copying src/watchdog/observers/kqueue.py -> /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/watchdog_deps/watchdog/build/lib3/watchdog/observers
copying src/watchdog/observers/__init__.py -> /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/watchdog_deps/watchdog/build/lib3/watchdog/observers
copying src/watchdog/observers/fsevents2.py -> /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/watchdog_deps/watchdog/build/lib3/watchdog/observers
copying src/watchdog/observers/winapi.py -> /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/watchdog_deps/watchdog/build/lib3/watchdog/observers
running egg_info
writing src/watchdog.egg-info/PKG-INFO
writing dependency_links to src/watchdog.egg-info/dependency_links.txt
writing entry points to src/watchdog.egg-info/entry_points.txt
writing requirements to src/watchdog.egg-info/requires.txt
writing top-level names to src/watchdog.egg-info/top_level.txt
reading manifest file 'src/watchdog.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.h' under directory 'src'
writing manifest file 'src/watchdog.egg-info/SOURCES.txt'
Searching Python 3.7 libraries...
Found Python library: /usr/lib/python3.7/config-3.7m-arm-linux-gnueabihf/libpython3.7.so
Found Python headers folder: /usr/include/python3.7m
Installing Omnisharp v1.35.3
Using cached Omnisharp: omnisharp.http-linux-x86.tar.gz
Extracting Omnisharp to /home/pi/.vim/plugged/youcompleteme/third_party/ycmd/third_party/omnisharp-roslyn...DONE
Done installing Omnisharp
go: finding github.com/kr/pty v1.1.1
go: finding golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e
go: finding gopkg.in/errgo.v2 v2.1.0
go: finding golang.org/x/tools v0.0.0-20200701133321-6ddc6be4d35f
go: finding golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d
go: finding golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529
go: finding gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127
go: finding golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3
go: finding golang.org/x/sys v0.0.0-20190412213103-97732733099d
go: finding golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2
go: finding golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
go: finding golang.org/x/text v0.3.0
go: finding golang.org/x/mod v0.2.0
go: finding golang.org/x/net v0.0.0-20200226121028-0de0cce0169b
go: finding golang.org/x/net v0.0.0-20190620200207-3b0461eec859
go: finding github.com/yuin/goldmark v1.1.27
go: finding golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e
go: finding golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550
go: finding golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
go: finding golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7
go: finding golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898
go: finding golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
go: finding golang.org/x/sync v0.0.0-20190423024810-112230192c58
go: downloading golang.org/x/tools v0.0.0-20200701133321-6ddc6be4d35f
go: downloading golang.org/x/tools/gopls v0.4.2
go: downloading honnef.co/go/tools v0.0.1-2020.1.4
go: downloading github.com/sergi/go-diff v1.1.0
go: downloading golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
go: downloading mvdan.cc/xurls/v2 v2.2.0
go: downloading golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
go: downloading golang.org/x/mod v0.2.0
go: downloading github.com/BurntSushi/toml v0.3.1
# golang.org/x/tools/internal/lsp/analysis/fillstruct
third_party/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/analysis/fillstruct/fillstruct.go:141:14: tok.LineStart undefined (type *token.File has no field or method LineStart)
third_party/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/analysis/fillstruct/fillstruct.go:170:15: tok.LineStart undefined (type *token.File has no field or method LineStart)
third_party/go/pkg/mod/golang.org/x/[email protected]/internal/lsp/analysis/fillstruct/fillstruct.go:172:15: tok.LineStart undefined (type *token.File has no field or method LineStart)
# golang.org/x/tools/internal/jsonrpc2
third_party/go/pkg/mod/golang.org/x/[email protected]/internal/jsonrpc2/messages.go:171:5: undefined: errors.As
third_party/go/pkg/mod/golang.org/x/[email protected]/internal/jsonrpc2/serve.go:129:5: undefined: errors.Is

解决方案


更新你的 Go 版本,它太旧了。 errors.As 是在 Go 1.13 中引入的。

以上就是《VIM编译时遇到Go错误后的YouCompleteMe修正》的详细内容,更多关于的资料请关注golang学习网公众号!

版本声明
本文转载于:stackoverflow 如有侵犯,请联系study_golang@163.com删除
逐步实现Python区块链项目:打造个性化区块链应用逐步实现Python区块链项目:打造个性化区块链应用
上一篇
逐步实现Python区块链项目:打造个性化区块链应用
如果缺少证书,调用 tls.LoadX509KeyPair 过程将会失败
下一篇
如果缺少证书,调用 tls.LoadX509KeyPair 过程将会失败
查看更多
最新文章
查看更多
课程推荐
  • 前端进阶之JavaScript设计模式
    前端进阶之JavaScript设计模式
    设计模式是开发人员在软件开发过程中面临一般问题时的解决方案,代表了最佳的实践。本课程的主打内容包括JS常见设计模式以及具体应用场景,打造一站式知识长龙服务,适合有JS基础的同学学习。
    542次学习
  • GO语言核心编程课程
    GO语言核心编程课程
    本课程采用真实案例,全面具体可落地,从理论到实践,一步一步将GO核心编程技术、编程思想、底层实现融会贯通,使学习者贴近时代脉搏,做IT互联网时代的弄潮儿。
    508次学习
  • 简单聊聊mysql8与网络通信
    简单聊聊mysql8与网络通信
    如有问题加微信:Le-studyg;在课程中,我们将首先介绍MySQL8的新特性,包括性能优化、安全增强、新数据类型等,帮助学生快速熟悉MySQL8的最新功能。接着,我们将深入解析MySQL的网络通信机制,包括协议、连接管理、数据传输等,让
    497次学习
  • JavaScript正则表达式基础与实战
    JavaScript正则表达式基础与实战
    在任何一门编程语言中,正则表达式,都是一项重要的知识,它提供了高效的字符串匹配与捕获机制,可以极大的简化程序设计。
    487次学习
  • 从零制作响应式网站—Grid布局
    从零制作响应式网站—Grid布局
    本系列教程将展示从零制作一个假想的网络科技公司官网,分为导航,轮播,关于我们,成功案例,服务流程,团队介绍,数据部分,公司动态,底部信息等内容区块。网站整体采用CSSGrid布局,支持响应式,有流畅过渡和展现动画。
    484次学习
查看更多
AI推荐
  • AI Make Song:零门槛AI音乐创作平台,助你轻松制作个性化音乐
    AI Make Song
    AI Make Song是一款革命性的AI音乐生成平台,提供文本和歌词转音乐的双模式输入,支持多语言及商业友好版权体系。无论你是音乐爱好者、内容创作者还是广告从业者,都能在这里实现“用文字创造音乐”的梦想。平台已生成超百万首原创音乐,覆盖全球20个国家,用户满意度高达95%。
    24次使用
  • SongGenerator.io:零门槛AI音乐生成器,快速创作高质量音乐
    SongGenerator
    探索SongGenerator.io,零门槛、全免费的AI音乐生成器。无需注册,通过简单文本输入即可生成多风格音乐,适用于内容创作者、音乐爱好者和教育工作者。日均生成量超10万次,全球50国家用户信赖。
    19次使用
  •  BeArt AI换脸:免费在线工具,轻松实现照片、视频、GIF换脸
    BeArt AI换脸
    探索BeArt AI换脸工具,免费在线使用,无需下载软件,即可对照片、视频和GIF进行高质量换脸。体验快速、流畅、无水印的换脸效果,适用于娱乐创作、影视制作、广告营销等多种场景。
    20次使用
  • SEO标题协启动:AI驱动的智能对话与内容生成平台 - 提升创作效率
    协启动
    SEO摘要协启动(XieQiDong Chatbot)是由深圳协启动传媒有限公司运营的AI智能服务平台,提供多模型支持的对话服务、文档处理和图像生成工具,旨在提升用户内容创作与信息处理效率。平台支持订阅制付费,适合个人及企业用户,满足日常聊天、文案生成、学习辅助等需求。
    21次使用
  • Brev AI:零注册门槛的全功能免费AI音乐创作平台
    Brev AI
    探索Brev AI,一个无需注册即可免费使用的AI音乐创作平台,提供多功能工具如音乐生成、去人声、歌词创作等,适用于内容创作、商业配乐和个人创作,满足您的音乐需求。
    23次使用
微信登录更方便
  • 密码登录
  • 注册账号
登录即同意 用户协议隐私政策
返回登录
  • 重置密码