This is an old revision of go from 10/14/2017 23:08 edited by EvaggelosBalaskas.
View source for go
**go** in **archlinux**
%%(html5)
$ sudo pacman -S go go-tools
$ go version
go version go1.9.1 linux/amd64
$ cat > helloworld.go << EOF
package main
import "fmt"
// This is a demonstrative comment!
func main() {
fmt.Println("Hello World!")
}
EOF
%%
%%
$ go run helloworld.go
fork/exec /tmp/go-build127438955/command-line-arguments/_obj/exe/helloworld: permission denied
$ mkdir -pv TMPDIR
mkdir: created directory 'TMPDIR'
$ export -p TMPDIR=TMPDIR/
$ go run helloworld.go
Hello World!
%%
%%
$ cat helloworld.go
package main
import "fmt"
// This is a demonstrative comment!
func main() {
fmt.Println("Hello World!")
}
%%
%%
$ gofmt helloworld.go
package main
import "fmt"
// This is a demonstrative comment!
func main() {
fmt.Println("Hello World!")
}
%%
%%
$ godoc fmt | head
use 'godoc cmd/fmt' for documentation on the fmt command
PACKAGE DOCUMENTATION
package fmt
import "fmt"
%%
%%
## The Go Programming Language - documentation in web server !
$ godoc -http=:8181
%%
%%
## Go uses static linking by default
$ go build helloworld.go
$ ls -l
total 752
-rwxr-x--- 1 ebal ebal 1855827 Oct 14 23:07 helloworld
-rw-r----- 1 ebal ebal 109 Oct 14 23:05 helloworld.go
$ ./helloworld
Hello World!