当前位置:网站首页>1 - first knowledge of go language

1 - first knowledge of go language

2022-04-23 14:40:00 Endless character

One 、Go Introduction to language

  • What is? Go Language :Go Is an open source programming language , It's meant to make it easy for people to build simple 、 reliable 、 Efficient software
  • Go Language advantage
    • ①. Fast running speed , Easy to learn
    • ②. High salary
    • ③. Suitable for blockchain development
    • ④. Cross platform
    • ⑤. Rich library of standards ( Instructions ),Go There are a lot of libraries built in , Especially the network library is very powerful
    • ⑥.Go It can also directly contain C Code , Take advantage of the existing rich C library
    • ⑦. Language level supports concurrency , This is Go The biggest feature , Born to support concurrency
  • What is concurrency : All running programs take turns CPU, Each program is allowed to occupy CPU The time is very short ( such as 10 millisecond ), So the user doesn't feel it at all CPU Is serving multiple programs in turn , It's like all programs are running continuously . The advantage of concurrency is that you can run multiple programs , Not Caton

Two 、Go Environmental installation

  • Go Installation package download address :https://golang.google.cn/dl/
    • There were 32 Bit and 64 Bit installation package , Recommended download .msi Installation package for installation

 Insert picture description here

  • Go install : function msi The installation files , Never appear Chinese in the installation path , All the way Next
  • GOPATH To configure : What will be written Go Program code method GOPATH Under the specified directory

 Insert picture description here

  • Go Install the test :cmd Command test
    • go version: Output version
    • go env: environmental information

 Insert picture description here

3、 ... and 、 first Go Program

  • compile Go Code go build file name .go What will be written Go Compile the code into a computer executable file
  • function exe Program .\Test.exe
  • Direct operation Go The source code file go run file name .go Will not generate exe file
package main
import "fmt"
func main(){
    
	fmt.Print("Hello Go")
}

 Insert picture description here

Four 、IDE-Goland

  • Goland Download address :https://www.jetbrains.com/zh-cn/go/download/other.html
    • According to your system , When the download is complete , All the way next Can be installed
       Insert picture description here

5、 ... and 、Go notes

  • Single-line comments : grammar //, Shortcut key -> CTRL+/
  • Multiline comment : grammar /* */, Shortcut key -> CTRL+ SHFIT +/

版权声明
本文为[Endless character]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231437071018.html

随机推荐