Linked e-resources
Details
Table of Contents
Intro
Table of Contents
About the Authors
About the Technical Reviewer
Preface
Chapter 1: Introduction
Is GoLang Static-Typed or Compiled?
Compiled Programming Language
Statically-Typed Language
Is Go an Object-Oriented Programming Language?
Features that Make GoLang the Premium Choice for Programming
Intentionally Excluded Features from GoLang
Go Programs
Summary
Chapter 2: Go Basics
Ancestors of Go
Go Syntax
Installing Go
Go Playground
Developing Go Applications Using IDEs
Getting Started Programming Go Applications
Let's Print Hello World!
How to Execute a Go Program
Keywords
Variables
Variable Data Types
Variable Naming Conventions
Declaring Variables
Taking User Input
Using scanf
Using Scanln
Using bufio
Math Operators and Packages
The Math Package
Dates and Times
Operators Precedence in Go
Memory Management and Reference Values
New vs Make
Incorrect Memory Allocation Example
Correct Memory Allocation Example
Memory Deallocation
Pointers Data Type
What Is a Pointer?
Declaring Pointers in Go
Comparison with Java and C-Style Languages
Ordered Values in Arrays and Slices
Arrays in Go
Declaring Arrays
Initializing Arrays
Accessing Array Elements
Querying the Size of an Array
Slices in Go
Defining Slices
The len( ) and cap( ) Functions
Nil Slice
Sub-Slicing in Go
The append( ) and copy( ) Functions
Sorting Slices
Maps
Defining Maps
Adding Entries to a Map Object
Deleting Entries from a Map Object
Iterating Over Stored Values in a Map Object
Structs Data Type
Defining a Structure
Accessing Members of a Structure
Passing Structures as Function Arguments
Pointers to Structures
Program Flow
If Statement
Switch Statement
For Statement
The goto Statement
Functions
Defining a Function
Doing Function Calls in Go
Return More than One Value from Functions
Passing Arguments to Functions
Call by Value Example
Call by Reference Example
Methods
Write/Read Text Files
Write Text Files
Read Text Files
HTTP Package
JSON
Summary
Chapter 3: Go Recipes: Programming Fundamentals and Basics
Numbers and Slices in Go
Working with Maps in Go
Go's Catch of Error Handling
Defer and Panic Recovery
Hands-on Challenge
Solution
Summary
Chapter 4: Working with Text
Go String Formatting and Working with Unicode
Case-Insensitive Comparisons in Go
Regular Expressions and Reading Text Files with Go
Hands-on Challenge
Solution
Summary
Chapter 5: Structs, Methods, and Interfaces
Go Structs, Methods, and Interfaces
Structs
Declaring Structs in Go
Creating Instances of a Struct Type
Recipe to See Structs in Action
Methods
Declaring Methods in Go
Recipe to See Methods in Action
Interfaces
Declaring Interfaces in Go
Table of Contents
About the Authors
About the Technical Reviewer
Preface
Chapter 1: Introduction
Is GoLang Static-Typed or Compiled?
Compiled Programming Language
Statically-Typed Language
Is Go an Object-Oriented Programming Language?
Features that Make GoLang the Premium Choice for Programming
Intentionally Excluded Features from GoLang
Go Programs
Summary
Chapter 2: Go Basics
Ancestors of Go
Go Syntax
Installing Go
Go Playground
Developing Go Applications Using IDEs
Getting Started Programming Go Applications
Let's Print Hello World!
How to Execute a Go Program
Keywords
Variables
Variable Data Types
Variable Naming Conventions
Declaring Variables
Taking User Input
Using scanf
Using Scanln
Using bufio
Math Operators and Packages
The Math Package
Dates and Times
Operators Precedence in Go
Memory Management and Reference Values
New vs Make
Incorrect Memory Allocation Example
Correct Memory Allocation Example
Memory Deallocation
Pointers Data Type
What Is a Pointer?
Declaring Pointers in Go
Comparison with Java and C-Style Languages
Ordered Values in Arrays and Slices
Arrays in Go
Declaring Arrays
Initializing Arrays
Accessing Array Elements
Querying the Size of an Array
Slices in Go
Defining Slices
The len( ) and cap( ) Functions
Nil Slice
Sub-Slicing in Go
The append( ) and copy( ) Functions
Sorting Slices
Maps
Defining Maps
Adding Entries to a Map Object
Deleting Entries from a Map Object
Iterating Over Stored Values in a Map Object
Structs Data Type
Defining a Structure
Accessing Members of a Structure
Passing Structures as Function Arguments
Pointers to Structures
Program Flow
If Statement
Switch Statement
For Statement
The goto Statement
Functions
Defining a Function
Doing Function Calls in Go
Return More than One Value from Functions
Passing Arguments to Functions
Call by Value Example
Call by Reference Example
Methods
Write/Read Text Files
Write Text Files
Read Text Files
HTTP Package
JSON
Summary
Chapter 3: Go Recipes: Programming Fundamentals and Basics
Numbers and Slices in Go
Working with Maps in Go
Go's Catch of Error Handling
Defer and Panic Recovery
Hands-on Challenge
Solution
Summary
Chapter 4: Working with Text
Go String Formatting and Working with Unicode
Case-Insensitive Comparisons in Go
Regular Expressions and Reading Text Files with Go
Hands-on Challenge
Solution
Summary
Chapter 5: Structs, Methods, and Interfaces
Go Structs, Methods, and Interfaces
Structs
Declaring Structs in Go
Creating Instances of a Struct Type
Recipe to See Structs in Action
Methods
Declaring Methods in Go
Recipe to See Methods in Action
Interfaces
Declaring Interfaces in Go