当前位置:网站首页>GO language study notes one
GO language study notes one
2022-07-30 05:02:00 【N. LAWLIET】
Learning go through algorithms
First go locale install
Enter goLang official websitehttps://golang.google.cn/dl/
I downloaded the go1.15.15.windows-amd64.msi version
After downloading, start the installation, it will automatically configure the environment variables, and then run cmd to see if the go version command is executed to see if the installation is successful.After installing go, install vscode and download it from the official website.
Then create a new goPath folder, and then create three folders under this folder, src, pkg and bin respectively. This folder is the go execution path, then edit the environment variable, create a new GOPATH in the system environment variable and put the goPathThe path is placed in it, and the ; interval is used to create a new go execution directory later.Then put %GOPATH% in Path.
Then configure the vscode setting.json (the location is in File->Preferences->Settings->The icon in the upper right corner opens the settings)
{"go.buildOnSave": "workspace","go.lintOnSave": "package","go.vetOnSave": "package","go.buildTags": "","go.buildFlags": [],"go.lintFlags": [],"go.vetFlags": [],"go.coverOnSave": false,"go.useCodeSnippetsOnFunctionSuggest": false,"go.formatOnSave": true,"go.formatTool": "goreturns","go.goroot": "D:\\Go","go.gopath": "D:\\GoPath","go.gocodeAutoBuild": false,"workbench.iconTheme": "vscode-icons","gopls": {"experimentalWorkspaceModule": true} },"go.toolsManagement.autoUpdate": true,"window.zoomLevel": -1,"terminal.integrated.sendKeybindingsToShell": true}Here, change go.goroot to your own go installation location, and go.gopath to the go execution file location.
Install the god extension in vscode after configuration

After installation, create a new go file, vscode will prompt you to install some plugins, click all install.
The installation may not be successful here, if the installation fails, you need to enter cmd to execute
go env -w GO111MODULE=on
go env -w GOPROXY=https://proxy.golang.com.cn,direct
Then execute go env to see if the change is successful, then go back and execute all install , if it still fails, you need to install manually
- In the
%GOPATH%\src\directory, create the pathgolang.org\x - Go to
%GOPATH%\src\golang.org\x, download the source code of the required toolsgit clone https://github.com/golang/tools.git tools - After the clone is completed, a tools folder will be generated, so that the source code required by the tool is ready
- Go to
%GOPATH%and execute go install github.com/ramya-rao-a/go-outlinego install github.com/acroca/go-symbolsgo install golang.org/x/tools/cmd/gurugo install golang.org/x/tools/cmd/gorenamego install github.com/rogpeppe/godefgo install github.com/sqs/goreturnsgo install github.com/cweill/gotests/gotests- Process golint separately, the source code of golint is located at
https://github.com/golang/lint, after entering%GOPATH%\src\golang.org\xExecutegit clone https://github.com/golang/lintdownload the source code required by golint - Go to
%GOPATH%and executego install github.com/golang/lint/golint
At this point, you are basically done, it is possible that the installation of gopls will fail
Also enter %GOPATH% and execute go install golang.org/x/tools/cmd/gopls
Then create a new main folder in src and then execute hold down shift and right-click to enter PowerShell to execute the go mod init main command, and then execute go build
At this point, the go locale is set up.
Finally, if you want vscode to run normally, you also need to configure lang.json (run -> add configuration) to configure it according to your own server and needs
{"name": "Launch","type": "go","request": "launch","mode": "debug","program": "${fileDirname}","env": { //environment variables"GOPATH":"D:/goPath","GOOS":"windows" //To be compiled into win},"args": [],"showLog": true,"configurations": [ ]}边栏推荐
- 【Verilog】HDLBits题解——Circuits/Combinational Logic
- Machine Learning: Knowing the Dimensionality Reduction Process Through Low Variance Filtering
- C语言实现安全性极高的游戏存档并读档
- 4. Web Development
- 22. 为什么需要消息队列?使用消息队列有什么好处?
- nSoftware.PowerShell.Server.2020
- Alibaba Cloud's EasyNLP Chinese text image generation model takes you to become an artist in seconds
- 复现XXL-JOB 任务调度中心后台任意命令执行漏洞
- C. Qualification Rounds
- 字符串问题(下)
猜你喜欢

(RCE) Remote Code/Command Execution Vulnerability Vulnerability Exercise

Solve the error SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xb7 in position 0: invalid start b

VisualStudio2022本地调试进入特别慢问题解决

斐波那契数列的递归优化《备忘录递归》

Golang channel implementation principle

1315_使用LOOPBACK模拟模式pyserial安装是否成功的测试

Discourse Custom Header Links

Shanxi group (enterprises) in the second network security skills competition part problem WP (7)

Predictive maintenance scheduling of multiple power equipment based on data-driven fault prediction
Go study notes (84) - Go project directory structure
随机推荐
String problem (below)
05 Detailed explanation of the global configuration file application.properties
Small program npm package--API Promise
2.6 Radix sort (bucket sort)
Classification of decision tree classification
Discourse Custom Header Links
"Translation" Envoy Fundamentals, this is a training course, make people to more quickly using Envoy Proxy..
C语言实现安全性极高的游戏存档并读档
全流程调度——Azkaban入门与进阶
Seven, custom configuration
Hexagon_V65_Programmers_Reference_Manual(10)
Simulation problem (middle)
nSoftware.PowerShell.Server.2020
handler+message [message mechanism]
BindingExpression path error: 'selectMenusList' property not found on 'object' ''ViewModel'
How to use labelme
Six, read application configuration + log configuration
POJ1321 chessboard problem (detailed explanation)
5. View parsing and template engine
go语言学习笔记二