Learn to Code Go in 17 minutes | Golang Programming Crash Course



Learn to Code Go in 17 minutes | Golang Programming Crash Course

Learn to Code Go in 17 minutes |  Golang Programming Crash Course

Welcome to this Crash Course in Go! Now if you’re here you’ve probably heard some good things about Go – low number of keywords in the language, which allows it to be picked up easily and intuitively like an interpreted language like python, while still being fast like C++. And all those cool concurrency features makes it a very good language for efficient software!

This video, of course in no way comprehensive of EVERY feature of Go, but enough to get you started!

Join this channel to get access to perks like behind the scenes and support my channel!
https://www.youtube.com/channel/UCzaYH6WeohiHKj3Ih_GdZdQ/join
or the same perks over on Patreon:
https://www.patreon.com/amarchenkova

Chapters:
0:00 Why Go?
0:34 Install Go & Jetbrains Goland
1:05 Packages, imports, main, and print
2:29 Basic Types & Operators
4:19 Composite Types: Arrays and Slices
7:02 Maps
8:07 Structs
8:58 Control Flow: If
9:26 Switch
9:58 For loops
10:44 Functions
11:25 Methods
11:49 Interfaces
13:27 Empty Interfaces
14:16 Goroutines & Channels

Resources to learn more Go!

Tour of Go: https://tour.golang.org/

The Go Programming Language Book: https://amzn.to/313UvqP

Go By Example: https://gobyexample.com/

Udemy course Learn How to Code: Google’s Go (Golang) Programming Language: https://click.linksynergy.com/link?id=Jn5ohPQU1IQ&offerid=507388.642102&type=2&murl=https%3A%2F%2Fwww.udemy.com%2Fcourse%2Flearn-how-to-code%2F

Building Web Applications with Golang: https://astaxie.gitbooks.io/build-web-application-with-golang/content/en/

Now, by the way, today I’m using the Jetbrains Go IDE Goland which you can get at https://www.jetbrains.com/go/.This is what I use in my professional development environment, but it does cost money. However there’s a free trial for 30 days and after that you can continue using it, it will just have to restart every 30 minutes. That’s annoying, but liveable.

Go programs are organized into packages. A package is a collection of source files in the same directory that are compiled together.

You can use gofmt or goimports tool to sort imports, and in Goland you can set up a file watcher in preferences with gofmt and go imports.

Go’s basic types:
Bool
String
Int and uint – signed and unsigned integers
float

And variations with different bit sizes
You can have int8, 16, 32, and 64, and unsigned ints uint8, 16, 32, and 64

Unsigned ints are only positive values, while signed ints range from negative to positive

Int32 is also called a “rune”
And a byte is the same as uint8

You can apply basic mathematical operators and comparisons to numeric types, so add numbers together, multiply, compare greater than, less than, and bitwise binary operators.

Strings can also be concatenated with a plus sign.

We can then combine these basic types into composite types!

Arrays is a sequence of elements of one type, and it’s a fixed length.

Slices are similar to arrays, but they can vary in length. You write it the same way as an array, but do not specify the number of elements.

Slices are really just pointers to an underlying array with a length and capacity, but they can grow in that length and capacity. The length is how many elements the slice has, the capacity is how much memory or space is available for elements. So a slice with a length of 3 has 3 elements in it, but may have a capacity that’s larger so you can add elements to it without having to expand the memory. This actually leads to interesting performance implications.

The crucial thing we can do with a slice is APPEND.

Like most languages, Golang has an if statement, switches, and for loops. However, Go does not have while loops!

A method is a function, but it also has a receiver argument, so which type it’s attached to.
We can also have an empty interface.

If we don’t know what types we’re going to get back, the empty interface can have any value assigned to it. You can think of an interface of holding the value, and the type.

Goroutines are similar to threads, but much cheaper, that can spin off and do their own thing.
Channels communicate between goroutines. Why do goroutines need to communicate? Well, we need to know when goroutines are done, and when we need to wait or continue.

Go routines and channels is where programming really gets interesting. A lot of programming is very sequential, and goroutines and channels can spin off operations while other code runs. It’s SUPER powerful!

Disclaimer: Affiliate links may be used in my recommendations! If you buy through my links I provide, I may receive a portion of the sale amount. This doesn’t change the price you pay.

#golang #programming #learntocode

Comments are closed.