当前位置:网站首页>Vscode configuring golang development environment
Vscode configuring golang development environment
2022-07-19 05:56:00 【One, two, three】
vscode To configure golang development environment
List of articles
The previous article introduced go Basic concepts and application scenarios of , For more information, click :
go Language introduction and application analysis
This article is based on vscode build go Integrated development environment , Why choose vscode, Just because of my habit , Here's how to vscode The structures, go Environmental Science ,vscode And go Language installation is not introduced here , Download and install the package directly , The following mainly introduces how to configure and use plug-ins .
1 go Import package environment configuration
The old version go There is no concept of package management , Cannot achieve similar python Of pip install -r requirements The function of automatically importing the required packages , And the bag can only be go Of PATH In the folder , To solve this problem , stay go The version is greater than 1.11 when , adopt GO111MODULE To solve this problem
First, through go version Determine whether the version is greater than 1.13, If not , Please download the new version , Otherwise, package management cannot be supported , If the old version is too troublesome , For example, the source cannot be changed , It is easy to have some problems in China ,GitHub and golang.org Stability and speed are both problems , Once there is a package that cannot be downloaded, it will inevitably report an error , A new version is recommended ,GO111MODULE First of all, it solves the problem that cannot be restored .
Enter the following command at the command prompt , Environment configuration :
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
Input go env See if the settings work
Before using the new package manager , The first thing to do is to go Project initialization , Generate go.mod, Execute the following command :go mod init Project name
2 vscode build go Inherit the plug-ins required by the compilation environment
2.1 go Language plug-ins
stay vscode Search in extensions go, install go plug-in unit :

2.2 Install other plug-ins
stay vscode Search and install the following in the extension go Related plug-ins , By means of vscode Command line ( Hold down Command+Shift+P ) Input Go:Install/Update Tools
Then select all , Click on OK
Check for installation go.docsTool
File->preferences->settings->"Search settings" lookup go.docsTool, choice gogetdoc, If not installed vscode Installation will be prompted , stay vscode terminal Enter the following command to install :go install -v github.com/zmb3/[email protected]
install gopls, commonly vscode Installation will be prompted , stay vscode terminal Enter the following command :go install golang.org/x/tools/[email protected]
stay setting Search for go.useLanguageServe Check whether it is selected , If... Is not selected , Check on
thus vscode Support go The relevant plug-ins of have been installed
3 vscode Run in go
At this time we pass through vscode open test Catalog , Under the directory, there are hello.go, If you run directly, you will be prompted Can't find .mod file , We need to initialize the project , Execute the following command :go mod init test
Will be in test Generate under directory go.mod file
Through F5 function , To run successfully , By means of main Make a breakpoint in , Breakpoint debugging can also be realized .
边栏推荐
猜你喜欢
![[附代码] 如何用HOG+SVM实现手写数字识别](/img/e1/870aec8bb75c7cf82dee62c68d1009.jpg)
[附代码] 如何用HOG+SVM实现手写数字识别

如何用NumPy读取和保存点云数据

热电阻pt100 CU50隔离转换器转4-20ma模拟量输出温度变送器0-10V

分享CS品牌贴片式T卡在打猎相机领域的运用案例

深入理解卡尔曼滤波器(2): 一维卡尔曼滤波器

7种视觉MLP整理(上)

FS68001无线充SOC芯片外围简单,5W无线充方案原理图

KU115 FPGA 高性能万兆光纤网络硬件加速卡 / 2 路 10G 光纤数据加速卡

BEVFormer: Learning Bird’s-Eye-View Representation from Multi-Camera Images via Spatiotemporal Trans

golang高并发特性goroutine介绍
随机推荐
A Survey of Robust LiDAR-based 3D Object Detection Methods for Autonomous Driving(激光雷达3D目标检测方法)论文笔记
Xinlinx zynq7020、7045国产替代 FMQL45T900 全国产化 ARM 核心板+扩展板
分享CS品牌SDNAND与可穿戴设备之间成功合作
Minio installation, deployment and simple use
Simple sorting of selective kernel networks methods
Dlib library and Dat file address
Run yolov5 process record based on mindspire
4 路 FMC+基带信号处理板( 4 路 2G 瞬时带宽 AD+DA)
比例阀放大板1A、2A、3A、5A比例阀驱动模块0-10V转0-24V
5种2D Attention整理(Non-Local、Criss-Cross、SE、CBAM、Dual-Attention)
李宏毅机器学习介绍-2022.07.11
[speech recognition] MFCC feature extraction
MCU单片机OTP
国际标准信号0-5V/0-10V/1-5V,0-10mA/0-20mA/4-20mA等的转换隔离和传输
HRA 1~12W 系列12V《宽压9~18V》转±250VDC等升压变换器
CS品牌SDNAND在颜色检测仪行业中的应用案例
FMC 子卡:4 通道 12bit 3.2G、 2 路 12bit、6.4G AD 采集/ 5G采集卡/6G采集卡
BEVFormer: Learning Bird’s-Eye-View Representation from Multi-Camera Images via Spatiotemporal Trans
CUDA编程-01: 搭建CUDA编程环境
Contrastive learning for image semantic segmentation (two articles)