Go development editor installation graphic explanation

Time:2022-5-11

123132131 

I Go development editor

  • There are a variety of development tools. Choose an editor suitable for you, and take into account efficiency and light weight
  • There are many editors suitable for go language development, including GoLand, idea, vs code, etc
  • Even using submit, Notepad + +, vim and so on can develop go language

1. Introduction to vs Code

  •  VS Code(Visual Studio code) is an open source product of MicrosoftfreeModern lightweight code editor
  • Support almost all mainstream development languagesSyntax highlighting, intelligent code completion, custom hotkeys, bracket matching, code snippets, code comparison diff, GITOther characteristics
  • Support plug-in extensionsIt supports win, MAC and Linux platforms

2. Download and install

  • Official download address: https://code.visualstudio.com/
  • Choose more than one platform to download (I use windows here)

image-20201206221458036

Double click Exe file, the next step is OK

image-20201206221743739

image-20201206221627861

image-20201206221932869

image-20201206222015331

Run after completion

image-20201206222122920

Enter this interface

If you are not used to English, you can install Chinese plug-ins

image-20201206222554813

After downloading, or prompt to restart the editor

image-20201206222635309

Home page function introduction

image-20201206225329488

Install go plug-in to make vs code support go language development

image-20201206225617617

II Solution to the failure of vs code to install go language plug-in

  • Problem Description: all“FAILED
  • Reason: by the wall

Installing github.com/mdempsky/gocode FAILED
Installing github.com/ramya-rao-a/go-outline FAILED
Installing github.com/acroca/go-symbols FAILED
Installing golang.org/x/tools/cmd/guru FAILED
Installing golang.org/x/tools/cmd/gorename FAILED
Installing github.com/stamblerre/gocode FAILED
Installing github.com/ianthehat/godef FAILED
Installing github.com/sqs/goreturns FAILED
Installing golang.org/x/lint/golint FAILED

Solution: adjustGoProxy settings for language

“Win + R” opens “CMD”, and versions above “go 1.13” are enabled by default
C:\Users\Administrator>go env -w GO111MODULE=on

Set agent
C:\Users\Administrator>go env -w GOPROXY=http://goproxy.io,dire

III Common shortcut keys

  •  Ctrl + /(single line note)
  • Shift + Alt + A(multiline comment)
  • Ctrl + Shift + Enter(insert a line above, and the mouse cursor can wrap directly to the previous line at any position of the current line)
  • Ctrl + Enter(insert a line below, and the mouse cursor can wrap directly to the next line at any position of the current line)
  • Alt + Shift + F(format code. You don’t need to select all the codes. You can format it directly)
  • Ctrl + Shift + F(find file)
  • Ctrl + GThen @ + method name(location of quick positioning method)
  • Ctrl + {(click the left bracket twice in a row to quickly realize {})
  • Ctrl + D(if you need to modify several places at the same time, just Ctrl + D several times. It’s super practical

psClick to select settings:keyboard shortcuts, all shortcut key directories will pop up on the right

IV First go program

Now let’s create the first onegoTest the program:

File name "go_hello. Go"
Package main // declares the main package, indicating that it is currently an executable program

Import "FMT" // import the built-in FMT package

Func main() {// main function, which is the entry of program execution
	fmt. Println("hello word shawn hahahah!") //  Print Hello world on the terminal!
}

Use the terminal (or CMD) ingoUsed in the directory where the file is locatedGo run [file name]To execute the file


PS E:\go> go run .\go_hello.go
hello word shawn hahahah!

image-20210120163728692

By now, the first go program has been completed. Next, we will enter the real go learning journey. Life is short, Le’s go

006r3PQBjw1f90iuw0n8hg3046046gmn

This is the end of this article about the installation of go development editor. For more information about the installation of go editor, please search the previous articles of developeppaer or continue to browse the relevant articles below. I hope you will support developeppaer in the future!