Goland找破解版不好找,所以我用LiteIDE,但是却自带缺陷没有代码自动补全功能,百度上找了很多篇文章都是错的,实际上要使用的包的是github.com/visualfc/gocode才对。最终终于找了些思路解决了。(segmentfault.com)

环境

  1. Golang 1.18
  2. LiteIDE 37.4
  3. Window 10

过程

安装Golang

https://go.dev/doc/install

安装LiteIDE

百度一下 “liteide 下载”

配置自动代码补全功能

1. 检查自己GOPATH目录
搜索“环境变量”,打开【环境变量】,找到自己GOPATH的目录,如下
image.png
GOPATH目录下的文件夹
image.png

2. 如果是更新的话,清空部分旧数据
删除 GOPATH/bin文件夹下 gocode.exe,gotools.exe
删除 GOPATH/pkg/mod/github.com的visualfc/gocode

3. 拉取 mdempsky/gocode
进入GOPATH/src

go mod init gocode
go get -u github.com/visualfc/gotools
go get -u github.com/visualfc/gocode

假如报错了

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

替换代理,解决方案:

go env -w GOPROXY=https://goproxy.cn,direct
go env -w GOPRIVATE=*.corp.example.com

4. 编译 gocode
进入GOPATH/src运行

go install github.com/visualfc/gocode
go install github.com/visualfc/gotools

检查 GOPATH/bin文件夹下 gocode.exe,gotools.exe是否重新生成

5. 替换LiteIDE的gocode.exe,gotools.exe
复制
GOPATH/bin文件夹下 gocode.exe,gotools.exe

LiteIDE安装目录bin下替换同名文件就可以了

IamHungryC
6. 不用重启电脑,重新打开LiteIDE验证

image.png

验证跳转函数,选中函数,单击F2即可

参考

https://github.com/visualfc/l...

iamhungry2
351 声望1 粉丝