当前位置:网站首页>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
边栏推荐
- Paging SQL
- ◰ GL shadow map core steps
- Node access to Alipay open platform sandbox to achieve payment function
- 如何用Redis实现分布式锁?
- Detailed explanation of file operation (2)
- PyMySQL
- LVM与磁盘配额
- Take according to the actual situation, classify and summarize once every three levels, and see the figure to know the demand
- Decimal format decimal / datetime conversion processing
- loggie 源码分析 source file 模块主干分析
猜你喜欢

TypeError: set_figure_params() got an unexpected keyword argument ‘figsize‘

Solution of garbled code on idea console

扫码登录的原理你真的了解吗?

自定义my_strcpy与库strcpy【模拟实现字符串相关函数】

How to choose the wireless gooseneck anchor microphone and handheld microphone scheme

Nodejs installation and environment configuration

计组 | 【七 输入/输出系统】知识点与例题

Deepinv20 installation MariaDB

Nodejs reads the local JSON file through require. Unexpected token / in JSON at position appears

oracle 中快速获取表的列名列表
随机推荐
Take according to the actual situation, classify and summarize once every three levels, and see the figure to know the demand
Mock test using postman
[problem solving] [show2012] random tree
织梦DEDECMS安全设置指南
Disk management and file system
Encapsulating the logging module
◰GL-阴影贴图核心步骤
Introduction to how to set up LAN
Decimal format decimal / datetime conversion processing
计算饼状图百分比
1959年高考数学真题
VLAN advanced technology, VLAN aggregation, super VLAN, sub VLAN
feign报400处理
Installation and management procedures
Rtklib 2.4.3 source code Notes
Dlib of face recognition framework
【题解】[SHOI2012] 随机树
The font of the soft cell changes color
Flask如何在内存中缓存数据?
Smart doc + Torna generate interface document