๐Ÿ““๐ŸŒฑ๐Ÿ’ป GuidoPercu.dev

Learning Go

Published on

Why Go?

We believe it’s worth trying again with a new language, a concurrent, garbage-collected language with fast compilation. Regarding the points above:

  • It is possible to compile a large Go program in a few seconds on a single computer.
  • Go provides a model for software construction that makes dependency analysis easy and avoids much of the overhead of C-style include files and libraries.
  • Go’s type system has no hierarchy, so no time is spent defining the relationships between types. Also, although Go has static types the language attempts to make types feel lighter weight than in typical OO languages.
  • Go is fully garbage-collected and provides fundamental support for concurrent execution and communication.
  • By its design, Go proposes an approach for the construction of system software on multicore machines. - Go Doc - What is the purpose of the project?

Instalation

On Arch Linux:

pacman -S go

For information about installing it in other systems, visit the official documentation.

Hello World!

package main
import "fmt"
 
func main() {
    fmt.Println("hello world")
}

Go By Example - Hello world

Fibonnaci (recursive)

func fibbRecc(number int) (numValue int){
if number == 0 || number == 1 {
    return number
}

return fibbRecc(number - 2) + fibbRecc(number -1)
}

Fatorial

func Factorial(n uint64)(result uint64) {
if (n > 0) {
    result = n * Factorial(n-1)
    return result
}
return 1
}

Books:

Tutorials

Courses:

Awesome