Home Development Tools VSCode How vscode configures the go language development environment

How vscode configures the go language development environment

Dec 30, 2019 pm 04:01 PM
go vscode development environment Configuration

How vscode configures the go language development environment

Install Go development extension

Now we need to install the Go extension plug-in for our VS Code editor, let It supports Go language development.

How vscode configures the go language development environment

Install Go language development tool kit

Press Ctrl Shift P on Windows platform and press Ctrl Shift P on Mac platform Command Shift P. At this time, an input box will pop up on the VS Code interface, as shown below:

How vscode configures the go language development environment

Enter >go:install in this input box, and the following will automatically search for related information. command, we select the command Go:Install/Update Tools

How vscode configures the go language development environment

How vscode configures the go language development environment

and select it and press Enter to execute the command (or click the mouse with the Command)

How vscode configures the go language development environment

Then click the "OK" button to install. The following input window will pop up:

VS Code will download and install the 16 tools listed above at this time. However, due to the domestic network environment, the installation will basically fail, as shown in the following FAILED:

How vscode configures the go language development environment

Solution: Use git to download the source code and then install it

We can manually download the tool from github, (To perform this step, you need to have git installed on your computer)

Step one: Now create the golang.org/x directory under the src directory of your GOPATH

Step two: In the terminal/cmd, cd to the GOPATH/src/golang.org/x directory

Step 3: Execute the git clone https://github.com/golang/tools.git tools command

Step 4: Execute the git clone https://github.com/golang/lint.git command

Step 5: Press Ctrl/Command Shift P and execute the Go:Install/Update Tools command again, Select them all in the pop-up window and click OK. This time the installation will be SUCCESSED.

After following the above steps, the installation can be successful. At this time, when you create a Go file, you can use code prompts, code formatting and other tools normally.

Configuring automatic saving

Click Preferences->Settings. When you open the settings page, you can see the relevant configuration of automatic saving as shown in the figure. You can choose the automatic saving method according to your own preferences:

How vscode configures the go language development environment

Configure code snippet shortcut keys

or Press Ctrl/Command Shift P, enter >snippets as shown below, select the command and execute it:

How vscode configures the go language development environment

How vscode configures the go language development environment

## Then click in the pop-up window Select the go option:

You can briefly read the above comments, which introduce the main usage:

How vscode configures the go language development environment

where $0 represents the final position of the cursor. For example, I have created two shortcuts here. One is to enter pln and the fmt.Println() code will be inserted into the editor; enter plf and the fmt.Printf("") code will be inserted.

How vscode configures the go language development environment

After adding the above configuration, save it.

Recommended related articles and tutorials:

vscode tutorial

The above is the detailed content of How vscode configures the go language development environment. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to disable wsl configuration file in vscode How to disable wsl configuration file in vscode How to disable wsl configuration file in vscode How to disable wsl configuration file in vscode May 09, 2024 am 10:30 AM

1. First, open the settings option in the settings menu. 2. Then, find the terminal column in the commonly used page. 3. Finally, uncheck the usewslprofiles button on the right side of the column.

How to open workspace trust permissions in Vscode Vscode method to open workspace trust permissions How to open workspace trust permissions in Vscode Vscode method to open workspace trust permissions May 09, 2024 am 10:34 AM

1. First, after opening the editing window, click the configuration icon in the lower left corner 2. Then, click the Manage Workspace Trust button in the submenu that opens 3. Then, find the page in the editing window 4. Finally, according to your office Just check the relevant instructions if required

How to run html with vscode How to run html with vscode How to run html with vscode How to run html with vscode May 09, 2024 pm 12:25 PM

1. First, use vscode software to write an html program. 2. Then, click the search button and enter openinbrowser. 3. After the installation is complete, you need to restart the software, then right-click on the HTML document and select openindefaultbrowser in the drop-down menu. 4. Finally, the software will open with the default browser.

How to open animation in Vscode Introduction to the method of opening animation in Vscode How to open animation in Vscode Introduction to the method of opening animation in Vscode May 09, 2024 am 10:28 AM

1. First, click to open the settings option in the More menu. 2. Then, find the terminal column under the Features section. 3. Finally, on the right side of the column, click the enableanimation button with the mouse and save the settings.

How to turn on smart commit in vscode Steps to turn on smart commit in vscode How to turn on smart commit in vscode Steps to turn on smart commit in vscode May 09, 2024 am 10:40 AM

Step 1: After opening the vscode software interface, click the settings button in the settings menu below. Step 2: Find the Git option under the Extensions column. Step 3: Click to check the enablesmartcommit button.

How to close the project folder in vscode_How to close the project folder in vscode How to close the project folder in vscode_How to close the project folder in vscode May 09, 2024 pm 02:13 PM

1. After opening the interface, click the mouse to select an item that needs to be deleted. 2. Find the close folder option in the file menu in the upper left corner. 3. Finally, find the specific location of the file in the document and right-click to delete it.

How to send Go WebSocket messages? How to send Go WebSocket messages? Jun 03, 2024 pm 04:53 PM

In Go, WebSocket messages can be sent using the gorilla/websocket package. Specific steps: Establish a WebSocket connection. Send a text message: Call WriteMessage(websocket.TextMessage,[]byte("Message")). Send a binary message: call WriteMessage(websocket.BinaryMessage,[]byte{1,2,3}).

How to install vscode vscode installation steps at a glance How to install vscode vscode installation steps at a glance May 09, 2024 am 10:22 AM

First, download the vscode software package, unzip it, run [exe. file], double-click to open, enter the installation wizard, read the agreement, click I agree, click Next, then select the installation location, the default is C drive, click Next, then select Start Menu folder, click Next to select additional tasks, click Next to prepare for installation, click Install. Installing, wait patiently. Finally, the installation is complete, click Finish, and exit the installation wizard.

See all articles