Press "Enter" to skip to content

Golang Basic 1 - Install && Hello World

Golang Basic 1 - Install && Hello World

What is Golang

  • Official website: https://golang.org/
  • Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.

How to install

Comments

  • 3 way to write a comments in go program.
  • // this is a single line comment
    
  • /*
    this is a
        multi line
            comment
    */
    

Hello World

usr@host:go/ # cat hello.go
package main    // if you want to run this program
import "fmt"    // import some build in packages, fmt is a packag e for print something on the screen
func main(){    // the main function, the entry of the program
    fmt.Println("Hello world.!")    // call fmt.Println to print something on the screen
}
usr@host:go/ # go build hello.go    # build the program
usr@host:go/ # ./hello  # run it
Hello world.!

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *