当前位置:网站首页>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
边栏推荐
- Smart doc + Torna generate interface document
- New project of OMNeT learning
- Installing labellmg tutorial in Windows
- VLAN advanced technology, VLAN aggregation, super VLAN, sub VLAN
- SQL: How to parse Microsoft Transact-SQL Statements in C# and to match the column aliases of a view
- Server log analysis tool (identify, extract, merge, and count exception information)
- LVM and disk quota
- Path environment variable
- Detailed explanation of the penetration of network security in the shooting range
- ∑GL-透视投影矩阵的推导
猜你喜欢

Dancenn: overview of byte self-developed 100 billion scale file metadata storage system

文件操作详解(2)

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

Use case labeling mechanism of robot framework

Mock test

Zhongang Mining: Fluorite Flotation Process

Feign report 400 processing

Set cell filling and ranking method according to the size of the value in the soft report

【PIMF】OpenHarmony啃论文俱乐部—在ACM Survey闲逛是什么体验

SQL database
随机推荐
Smart doc + Torna generate interface document
loggie 源码分析 source file 模块主干分析
PostgreSQL列存与行存
ACL 2022 | DialogVED:用于对话回复生成的预训练隐变量编码-解码模型
自定义my_strcpy与库strcpy【模拟实现字符串相关函数】
UWA Pipeline 功能详解|可视化配置自动测试
Get the column name list of the table quickly in Oracle
NVIDIA graphics card driver error
PHP efficiently reads large files and processes data
Idea of batch manufacturing test data, with source code
Multithreaded @ async thread pool
STM32__ 03 - beginner timer
Regular filtering of Intranet addresses and segments
Paging the list collection
On the security of key passing and digital signature
Zhimeng dedecms security setup Guide
Flask如何在内存中缓存数据?
Installation and management procedures
Installing labellmg tutorial in Windows
MySQL personal learning summary