Home>Article>Development Tools> How to develop Golang in VSCode? Introduction to development environment configuration

How to develop Golang in VSCode? Introduction to development environment configuration

青灯夜游
青灯夜游 forward
2022-02-18 11:06:39 2828browse

How to develop Golang in vscode? The following article will introduce you to the method of configuring and building the Golang development environment invscodethrough pictures and texts. I hope it will be helpful to you!

How to develop Golang in VSCode? Introduction to development environment configuration

Build the Golang development environment in vscode

The first step

Download the Go installation package, address: Go Language Chinese Network (https://studygolang.com/dl), the directory after the installation is completed is as follows:

How to develop Golang in VSCode? Introduction to development environment configuration

Check the current version through the command line:

How to develop Golang in VSCode? Introduction to development environment configuration

[Related recommendations:Go video tutorial]

Second step

Configure environment variables and create two new environment variables, as follows:

How to develop Golang in VSCode? Introduction to development environment configuration

#For configurations on other platforms, please refer to the goproxy official website.

The third step

Open vscode, install a Go plug-in, as follows:

How to develop Golang in VSCode? Introduction to development environment configuration

Then open a folder and create a hello.go file. At this time, you will be prompted to install the corresponding application in the lower right corner. Select Install All and wait for installation. A successful installation is as follows:

How to develop Golang in VSCode? Introduction to development environment configuration

How to develop Golang in VSCode? Introduction to development environment configuration

The environment is now set up. [Recommended learning: "vscode introductory tutorial"]

Step 4

Write the go program in the hello.go file

package main import "fmt" func main() { fmt.Println("hello World") }

Execute the following command in the terminal, and thego.modfile will be generated

go mod init gitee.com/mall_lucy/my_go_studycode

How to develop Golang in VSCode? Introduction to development environment configuration

Then run hello.go in the terminal, as follows :

How to develop Golang in VSCode? Introduction to development environment configuration

For more programming-related knowledge, please visit:Programming Video! !

The above is the detailed content of How to develop Golang in VSCode? Introduction to development environment configuration. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete