Go Install
~$ sudo apt-get update
~$ sudo apt install golang-go
~$ go version
go version go1.18.1
Hugo Install
~$ sudo apt update
~$ sudo apt -y install hugo
~$ hugo version
hugo v0.92.2
Hello World
サンプルプログラム
package main
import "fmt"
func main() {
message := greetMe("world")
fmt.Println(message)
}
func greetMe(name string) string {
return "Hello, " + name + "!"
}
Run the program as below:
$ go run hello.go
GO Variables
Normal Declaration:
var msg string
msg = "Hello"
Shortcut:
msg := "Hello"
Constants
const Phi = 1.618