Debian 11.2にGo言語をインストールする
環境情報
# cat /etc/debian_version
11.2
インストールの方法
1.Go をインストールします
# apt -y install golang
# apt -y install golang
# apt -y install golang
2.バージョンを確認します
# go version
go version go1.15.15 linux/amd64
# go version
go version go1.15.15 linux/amd64
# go version go version go1.15.15 linux/amd64
3.動作確認
# nano test.go
以下の内容を編集します
package main
import "fmt"
func main() {
fmt.Println("study Go become smart")
}
# nano test.go
以下の内容を編集します
package main
import "fmt"
func main() {
fmt.Println("study Go become smart")
}
# nano test.go 以下の内容を編集します package main import "fmt" func main() { fmt.Println("study Go become smart") }
方法1
ファイルを実行します
# go run test.go
study Go become smart
# go run test.go
study Go become smart
# go run test.go study Go become smart
方法2
ファイルをビルドして実行します
# go build test.go
# ./test
study Go become smart
# go build test.go
# ./test
study Go become smart
# go build test.go # ./test study Go become smart