Go Language Tutorial

Go is an open-source programming language that makes it easy to build simple, reliable, and efficient software.

Development of Go began in late 2007 under the leadership of Robert Griesemer, Rob Pike, and Ken Thompson, with Ian Lance Taylor, Russ Cox, and others joining later. It was ultimately open-sourced in November 2009, and the stable Go 1 version was released in early 2012. Today, Go's development is fully open and has an active community.


Go Language Features

  • Simple, fast, safe
  • Parallel, fun, open source
  • Memory management, array safety, fast compilation

Go Language Applications

The Go language is designed as a systems programming language for use on massive central servers hosting web servers, storage clusters, or similar purposes.

For high-performance distributed systems, Go undoubtedly offers higher development efficiency than most other languages. It provides massive parallel support, which is perfect for game server-side development.


The first Go program

Next, let's write our first Go program, hello.go (the extension of Go language source files is .go). The code is as follows:

hello.go file

package main

import "fmt"

func main() {
    fmt.Println("Hello, World!")
}

Run Example »

To execute Go language code, you can usego runcommand.

Executing the above code outputs:

$ go run hello.go 
Hello, World!

Additionally, we can also usego buildcommand to generate binary files:

$ go build hello.go 
$ ls
hello    hello.go
$ ./hello 
Hello, World!
other extensions