The “Go” Learning Trip — 0. Base build

  • Post author:
  • Post category:其他

# Environmental installation

# Official address :(over the wall may be required)

https://golang.org/dl/

 

# IDE Tools: (Visual Studio Code)

https://code.visualstudio.com/?wt.mc_id=vscom_downloads

 

 

 

# envionment variables

Once the installation is complete, it needs to be set in the system environment variables

 

 

“GOPATH” is Project Directory

 

“GOROOT” is The “Go” Install Directory

PATH needs set up the installation directory in bin directory

 

# Open CMD shell , Input “go env” check it 

 

 

扩展了解:

对于Visual Studio Code开发工具,有一款优秀的GoLang插件,它的主页为:https://github.com/microsoft/vscode-go

这款插件的特性包括:

 

Colorization 代码着彩色

Completion Lists 代码自动完成(使用gocode)

Snippets  代码片段

Quick Info 快速提示信息(使用godef)

Goto Definition 跳转到定义(使用godef)

Find References  搜索参考引用(使用go-find-references)

File outline 文件大纲(使用go-outline)

Workspace symbol search 工作区符号搜索(使用 go-symbols)

Rename 重命名(使用gorename)

Build-on-save 保存构建(使用go build和go test)

Format 代码格式化(使用goreturns或goimports或gofmt)

Add Imports  添加引用(使用 gopkgs)

Debugging 调试代码(使用delve)

 

# 按下F5,提示不能调试,要安装调试工具。

go get -v -u github.com/peterh/liner   

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

 

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-find-references

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

 

转载于:https://www.cnblogs.com/Cong0ks/p/11504769.html