编写第一个驱动程序
什么是去? (What is Go?)
Go is programming language introduced by Google at 2009. It’s syntactically similar to C but with memory safety and garbage collection.
Go是Google在2009年推出的编程语言。从语法上讲,它类似于C,但是具有内存安全性和垃圾回收功能。
为什么要学习围棋? (Why learn Go?)
Go is a very modern programming language (unlike python that is introduced at 1990) that deals with modern computers and problems. It’s a small language containing only 25 keywords. The inventors of Go didn’t blindly follow the typical ideas of computer languages. Go is a very easy and clean to write and read.
Go是一种非常现代的编程语言(不同于1990年引入的python),它处理现代计算机和问题。 这是一种仅包含25个关键字的小语言。 Go的发明者并没有盲目地遵循计算机语言的典型思想。 围棋是一件很容易的和干净的写入和读取。
在Windows上安装Go (Install Go on Windows)
Download and Install the Microsoft Windows file from this link.
下载并安装由微软Windows文件这个链接。
- Download and Install VS Code (Editor). 下载并安装VS Code(编辑器)。
- That’s all. We are ready to work 就这样。 我们准备工作
在Go中打印“ Hello World” (Print “Hello World” in Go)
Fire up your VS Code and create a new file main.go (.go is the Go file’s extension). Write the following lines of codes in the main.go file.
启动你的VS代码,并创建一个新的文件main.go(。去是去文件的扩展名)。 将以下代码行写入main.go文件中。
package main
import "fmt"func main() {
fmt.Println("hello world")
}
Now open the VS Code’s terminal by pressing ctrl+~ . You will see something like this:
现在,按ctrl +〜打开VS Code的终端 。 您 会看到这样的东西:
Write the following line in the terminal to run the main.go file
在终端中编写以下行以运行main.go文件
go run main.go
If everything is okay, the output will look like this:
如果一切正常,输出将如下所示:
Hurrah! You have written your first code in Go.
欢呼! 您已经在Go中编写了第一个代码。
I will come with more posts on Go Programming in future.
将来,我将提供更多有关Go编程的文章。
Peace !!
和平!
翻译自: https://medium.com/@md.alifbiswas/write-your-first-program-in-go-a55b84898a13
编写第一个驱动程序