Difference between revisions of "Coding with Funtoo Linux/Golang Tutorial"

From Funtoo
Jump to: navigation, search
(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...")
 
(No difference)

Latest revision as of 07:56, October 23, 2018

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 #