Wanted to learn Golang.
This repo will be full of tests and demo stuff while I learn Golang.
Also it will be starting point of my Golang presentation that we are doing internally with collegues and friends.
// Info and Starting point
Agenda:
- maybe something about packages and workspace etc
- functions.go
- variables.go
- types.go
- constants.go
- loops.go
- if.go
- structs.go
- arrays.go
- ranges.go
- maps.go // excercise maps
- functios_vol2.go // exercise functions
- switch.go
- methods.go
- methods_vol2.go
- interfaces.go // exercise interfaces
- Errors
- Web Servers
This is just an introduction and it's very premature. I don't know enough to convince you why go is so good and powerfull or better that the rest of the programming languages out there.
Go is a statically-typed language with syntax loosely derived from that of C, adding garbage collection, type safety, some dynamic-typing capabilities, additional built-in types such as variable-length arrays and key-value maps, and a large standard library.
It's different, it's not Java or Ruby or Php.
"Go’s purpose is therefore not to do research into programming language design; it is to improve the working environment for its designers and their coworkers. Go is more about software engineering than programming language research. Or to rephrase, it is about language design in the service of software engineering."
- Rob Pike Go at Google
But Go is awesome, and you can get a lot done with it…you just have to learn it first. It’s tempting to approach new languages from the mindset of another language, but that will be most unhelpful here.
The creation myth of Go is something like this: Rob Pike, Ken Thompson, and Robert Griesemer were waiting for a particularly long C++ build to take place when they decided to theorize a new language.
Go was meant to solve some few problems:
-
Development Speed
- build times (as php programmers we don't have this but let's say that C++ can take some time)
- you are more productive when you don't wait too long for a single build etc..
-
Modern
- C++ 1979. Python 1989. Java 1990. Ruby 1993.
- Concurency (very easy and fast to develop)
- Standart Library (batteries included :))
-
Complexity
- How many loop keywords are there? 1 for
- Why Garbage Collection? Because it’s easier while working with concurrency.
- Why eliminate inheritance? Because it’s inflexible to change and composition is almost always better.
- How many keywords? 25. vs 50 in Java and 48 in C
Go projects are used almost everywhere .. etc..