Очень кратко — установка Golang, языка программирования от Google, и пример «Hello, World«.
Для установки Golang на RHEL-дистрибутивы — требуется репозиторий Epel:
$ sudo yum repolist enabled ... epel Extra Packages for Enterprise Linux 6 - x86_64 11689+165 epel-debuginfo Extra Packages for Enterprise Linux 6 - x86_64 - Debug 2167+24 ...
Устанавливаем:
$ sudo yum install golang .... (1/3): golang-1.5.1-0.el6.x86_64.rpm | 1.2 MB 00:00 (2/3): golang-bin-1.5.1-0.el6.x86_64.rpm | 41 MB 00:06 (3/3): golang-src-1.5.1-0.el6.noarch.rpm | 3.7 MB 00:01 ...
Проверяем:
$ which go /usr/bin/go
Получение помощи:
$ go help
Go is a tool for managing Go source code.
Usage:
go command [arguments]
The commands are:
build compile packages and dependencies
...
vet run go tool vet on packages
Use "go help [command]" for more information about a command.
Additional help topics:
c calling between Go and C
...
testfunc description of testing functions
Use "go help [topic]" for more information about that topic.
Создаем файл с расширением .go с таким содержимым:
package main
import "fmt"
func main() {
fmt.Println("Hello, World.")
}
Запускаем:
$ go run hw.go Hello, World.
Готово.
Ссылки по теме