Windows环境墙内搭建Go语言集成开发环境


1 安装go环境

太简单略

2 安装vs code

找到微软的官方网站,下载Visual Studio Code,官网地址https://code.visualstudio.com/

image

安装完成后进入Visual Studio Code,使用快捷键F1,打开命令面板

imageimage

image

3 安装git

 

4 安装go环境

设置环境变量GOPATH,GOPATH是你的工作目录。默认C:\用户\go

GOROOT,golang编译器安装目录

安装工具一键命令,这个我也不知道具体是什么,是按照vs code提示安装的

image

gocode
gopkgs
go-outline
go-symbols
guru
gorename
dlv
godef
goreturns
golint
 
 

Installing github.com/mdempsky/gocode SUCCEEDED

Installing github.com/uudashr/gopkgs/cmd/gopkgs SUCCEEDED

Installing github.com/ramya-rao-a/go-outline FAILED

Installing github.com/acroca/go-symbols FAILED

Installing golang.org/x/tools/cmd/guru FAILED

Installing golang.org/x/tools/cmd/gorename FAILED

Installing github.com/derekparker/delve/cmd/dlv SUCCEEDED

Installing github.com/rogpeppe/godef SUCCEEDED

 

go get -u -v github.com/nsf/gocode
go get -u -v github.com/rogpeppe/godef
go get -u -v github.com/golang/lint/golint
go get -u -v github.com/lukehoban/go-outline
go get -u -v sourcegraph.com/sqs/goreturns
go get -u -v golang.org/x/tools/cmd/gorename
go get -u -v github.com/tpng/gopkgs
go get -u -v github.com/newhook/go-symbols
go get -u -v golang.org/x/tools/cmd/guru

这里时间会很长,很多工具都会出现安装失败的情况,下面分析失败时的解决方法。

如:sourcegraph.com/sqs/goreturns

在安装时提示如下:

image

可以看到最终使用的地址如图划线部分

就可以直接写为

go get -u –v https://github.com/sqs/goreturns

在等待一段时间后可以安装完成。

如:安装很慢或提示失败时:可以根据提示工具的名称,区搜github的地址,之后clone。

举例:如https://github.com/sqs/goreturns

clone下来后 放置$GO_PATH/src/github.com/sqs/goreturns

之后再去执行go get -u –v https://github.com/sqs/goreturns,此时很快就生成可执行文件了

 

f5调试工具安装

go get -v -u github.com/peterh/liner github.com/derekparker/delve/cmd/dlv

image

 

最后完成后再%GO_PATH中生成的可执行文件

image

此时vs code可以正常使用了

 

 

参考信息:

https://studygolang.com/articles/8284

http://www.cnblogs.com/zsy/p/5223957.html

https://segmentfault.com/q/1010000016275441

中文设置无效:https://segmentfault.com/q/1010000016275441

解决安装失败问题:https://blog.csdn.net/bing2011/article/details/81183569

https://zhuanlan.zhihu.com/p/26473355


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM