Note
The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.
Coding with Funtoo Linux/Golang Tutorial
Jump to navigation
Jump to search
This Golang programming tutorial is a great guide to help you get started with programming in Golang (or simply Go) under Funtoo Linux. We will list more Go tutorials and programming examples to master your knowledge of Go Programming later in this tutorial.
- Go is a programming language designed by Google engineers Robert Griesemer, Rob Pike, and Ken Thompson. Go is a statically typed, compiled language in the tradition of C, with the added benefits of memory safety, garbage collection, structural typing, and CSP-style concurrency. The compiler, tools, and source code are all free and open source. Golang first appeared on November 10, 2009.
Installing Go
Installation of go in Funtoo Linux is as easy as:
root # emerge -v go These are the packages that would be merged, in order: Calculating dependencies... done! [ebuild N ] dev-lang/go-1.10.2:0/1.10.2::lang-kit USE="-gccgo" 71,981 KiB Total: 1 package (1 new), Size of downloads: 71,981 KiB
This will install the latest go available in portage.
First script
hello.go
(go source code) - Hello world Golang programpackage main
import "fmt"
// this is a comment
func main() {
fmt.Println("Hello, Funtoo!")
}
Now you can run the program with:
root # go run hello.go Hello, Funtoo! root #