Overview of GoLang Training
Go is an open-source programming language created by google. As one of the fastest growing languages in terms of popularity, it’s a great time to pickup the basics of go! This course is designed to get you up and running as fast as possible with go. We’ll quickly cover the basics, then dive into some of the more advanced features of the language.
- Understand the basic syntax and control structures of the language
- Apply Go’s “OOP” – Structs, Interfaces, Encapsulation, Inheritance, Polymorphism
Duration
3 Days
Prerequisite for GoLang
Should have programmed in any other language like Java/C#/C/C++/etc.
Course Outline for GoLang
Outline
The Go Language, Control Structures
Why Go?
- The Beginnings of Go
- Go vs Other languages
- Supported Platforms, Cross Compiling
- Key Distinguishing Features
Setting Up Go
- Downloading and Installing Go Setting up Go
- Environment Variables
- Why do we need Git, Mercurial, etc.?
- Go Playground
Basic Program, Go Tools
- Hello World, packages, import, main & main
- Go build
- Go run
Working with Strings
- String Functions
- String Formatting
Data Types
- Data Types in Go.
- Zero Values
Variables and Assignment
- var, := differences new
- Multiple assignment
- Values
- Variables
- Constants
Defer Statement
- Defer
- Defer Evaluation
Errors
- Errors in Go
- Error Conventions
- Custom Errors panic and recover
- defer
Cross Compiling
- Cross Compiling Go Programs
Functions
- Writing a Function
- Return Values
- Multiple Return Values
Pointers, Parameters, Return Values
- Pointers
- Parameters
- Pass by Value, Pass by Reference
Defer, Continue, break, goto, fallthrough
- continue, break, goto with label
- fallthrough for switch
More Go Tools, External Tools, Editor Settings
- go fmt
- go imports nsf/gocode
- go, vet
- vim-go for vim users
- sublime text plugins
- vs-code plugins
- atom plugins
Control Statements
- If/Else
- Switch
Arrays, Slices, Maps, for
- For
- Arrays Slices
- Maps
- Range , continue, break, goto, fallthrough
“OOP” – Structs, Interfaces, Encapsulation, Inheritance, Polymorphism
Structs
- Structs
- Struct Members
- Anonymous Struct Members
- Methods on Structs
- Pointer and Value Receivables in struct methods
- How structs take place of objects
Interfaces
- Interfaces
- Implicitness of Interfaces
- Example with io.Reader and io.Writer
- Type Assertion
- Type Assertion and Switch
Encapsulation, “Object Hierarchy”, “OOP”
- Data Hiding
- Struct Inheritance with Composition
- Polymorphism