Coding with Funtoo Linux/Golang Tutorial

From Funtoo
< Coding with Funtoo Linux
Revision as of 07:56, October 23, 2018 by Palica (talk | contribs) (Created page with "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 prog...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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 program
package 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 #