当前位置:网站首页>VsCode-Go
VsCode-Go
2022-04-23 16:54:00 【The interview was rejected 10000 times】
Use Vscode debugging go
Install well [Vscode](https://code.visualstudio.com/)
Install well [Go](https://go.dev/dl/)
Windows download .msi Package with suffix ,
mac download .pkg Package with suffix ,
linux Download suffix tar.gz ( decompression tar -zxvf Package name )
> go Default installed in C:\Program Files\GO perhaps C:\User\GO Which one did I forget , I usually install it by default C"\ Under the root directory of
Edit environment variables
Windows:
Individual user environment variables :
GOPATH( Variable name ) : C:\Go\bin ( A variable's value )
Path( Variable name ) : C:\Go\bin ( A variable's value )
System variables :
Path( Variable name ) : C:\Go\bin ( A variable's value )
linux
vi /etc/profile,
write in export PATH=$PATH:/usr/local/go/bin sign out
source /etc/profile
Set up the environment , Access terminal Input go version , If the version is not displayed , Just restart the computer ....
Use Vscode To configure Go Environmental Science
Use Vscode Download a GO The expansion pack, , Open one Go Project folder for , Create a , Use VsCode Open this folder
Build test code
main.go
package main
import (
"fmt"
)
func main() {
fmt.Println("Hello World")
fmt.Println("Hello World")
}
You will be prompted to install the plug-in , Due to some known problems , Downloading is a little troublesome , I just put my download into a package
Go Plug-in package , Unzip it and put it in the installation go The folder bin below
Set up go env
go env -w GO111MODULE=on //go The command line will use modules
go env -w GOPROXY=https://goproxy.cn,direct // Use seven cow cloud
Set up launch.json
New version of the Vscode You don't have to set it GOPATH and GOROOT, open Vscode function >> Add the configuration
{
"version": "0.2.0",
"configurations": [
{
"type": "go",
"request": "launch",
"name": "Launch",
"mode":"debug",
"program": "${file}"
}
]
}
initialization mod
go mod init Project folder name
You can try debugging , Pay attention to main.go File startup F5 debugging , Be careful main.go The package name must be “package main”.
About go mod yes go1.11 Project management module , Learning this module can be accessed go mod Study
Configuration problem , Take a look at this blog Configuration learning
Configuration problem , Take a look at this blog Configuration learning
版权声明
本文为[The interview was rejected 10000 times]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231359046320.html
边栏推荐
- 计组 | 【七 输入/输出系统】知识点与例题
- ◰ GL shadow map core steps
- RAID磁盘阵列与RAID5的创建
- Change the password after installing MySQL in Linux
- 正则过滤内网地址和网段
- 【解决报错】Error in v-on handler: “TypeError: Cannot read property ‘resetFields’ of undefined”
- Derivation of Σ GL perspective projection matrix
- Installation and management procedures
- Installing labellmg tutorial in Windows
- VLAN高级技术,VLAN聚合,超级Super VLAN ,Sub VLAN
猜你喜欢
org. apache. parquet. schema. InvalidSchemaException: A group type can not be empty. Parquet does not su
PyTorch:train模式与eval模式的那些坑
RTKLIB 2.4.3源码笔记
DanceNN:字节自研千亿级规模文件元数据存储系统概述
Bytevcharts visual chart library, I have everything you want
Modify the test case name generated by DDT
Rtklib 2.4.3 source code Notes
Selenium IDE and XPath installation of chrome plug-in
信息摘要、数字签名、数字证书、对称加密与非对称加密详解
Project framework of robot framework
随机推荐
SQL: How to parse Microsoft Transact-SQL Statements in C# and to match the column aliases of a view
Solution of garbled code on idea console
About background image gradient()!
昆腾全双工数字无线收发芯片KT1605/KT1606/KT1607/KT1608适用对讲机方案
OMNeT学习之新建工程
信息摘要、数字签名、数字证书、对称加密与非对称加密详解
【PIMF】OpenHarmony啃论文俱乐部—在ACM Survey闲逛是什么体验
Regular filtering of Intranet addresses and segments
无线鹅颈麦主播麦手持麦无线麦克风方案应当如何选择
RAID磁盘阵列与RAID5的创建
Path environment variable
[problem solving] [show2012] random tree
文件操作详解(2)
Query the data from 2013 to 2021, and only query the data from 2020. The solution to this problem is carried out
Detailed explanation of UWA pipeline function | visual configuration automatic test
Blue Bridge Cup provincial road 06 -- the second game of the 12th provincial competition
SQL database
正则过滤内网地址和网段
Rtklib 2.4.3 source code Notes
The new MySQL table has a self increasing ID of 20 bits. The reason is