Hello World in Go
Created
Modified
source code
package main
import "fmt"
func main() {
fmt.Println("Hello,世界,こんにちは,안녕하세요")
}
To run the program
Go is a compiled language. The Go toolchain converts a source program and the things it depends on into instructions in the native machine language of a computer.
use go run
go run helloworld.go
Hello,世界,こんにちは,안녕하세요
Go natively handles Unicode, so it can process text in all the world’s languages.
using go build
If the program is more than a one-shot experiment, it’s likely that you would want to compile it once and save the compiled result for later use. That is done with go build:
use go build
go build helloworld.go
./helloworld
Hello,世界,こんにちは,안녕하세요