Go is a statically typed, compiled high-level programming language designed at Google by Robert Griesemer, Rob Pike, and Ken Thompson. It is syntactically similar to C, but also has memory safety, garbage collection, structural typing, and CSP-style (Communicating Sequential Processes) concurrency.
- Go is a cross-platform, open source programming language
- Go can be used to create high-performance applications
- Go is a fast, statically typed, compiled language that feels like a dynamically typed, interpreted language
- Go was developed at Google by Robert Griesemer, Rob Pike, and Ken Thompson in 2007
- Go's syntax is similar to C++
A Go file consists of the following parts:
- Package declaration
- Import packages
- Functions
- Statements and expressions
- Define it using package Keyword followed by main library.
- import ("fmt")
- A blank line. Go ignores white space. Having white spaces in code makes it more readable.
- func main() {} is a function. Any code inside its curly brackets {} will be executed.
- fmt.Println() is a function made available from the fmt package. It is used to output/print text.
-
Hello World
-
Variables
-
Types
-
Function
-
Packages
-
Conditional Statements and Loops:
- if else statement
- Loops
- Switch Statement
-
Arrays, Slices and Variadic Functions:
- Array & Slices
- Variadic Functions
-
More types:
- Maps
- Strings
-
Pointers, Structs and Methods:
- Pointers
- Structs
- Methods
-
Interfaces:
- Interfaces - I
- Interfaces - II
-
File Handling:
- Reading Files
- Writing Files