My First Go Book
My First Go Book
stepping into the world of Golang
About the Book
Book Title: My First Go Book
Author: Mohd Ejaz Siddiqui
Total Pages: 183
--------------------------
Overview:
My First Go Book is the perfect starting point for anyone eager to learn Go programming. Whether you are a complete beginner or an experienced developer exploring a new language, this book will guide you through the fundamentals of Go with easy-to-follow examples.
What You Will Learn:
- The basics of Go syntax and structure.
- How to work with variables, data types, and functions.
- Best practices for writing clean, efficient Go code.
- Building and testing scalable applications.
- Advanced concepts like concurrency, error handling, and more.
Why Choose This Book?
This book simplifies complex concepts, offering real-world examples and actionable advice. By the end, you will feel confident tackling projects in Go.
Start your Go programming journey today with My First Go Book! Download now and unlock the power of Go!
Table of Contents
- Introduction to Go
- 1.1 What Is Go?
- 1.2 What Problem Does Go Solve?
- 1.3 Why Should I Learn Go?
- Installing Go
- 2.1 Installing Go on macOS
- 2.2 Installing Go on Windows
- A Basic Go Program
- 3.1 Project Setup
- 3.2 Hello, World!
- 3.3 More About import
- 3.4 Compiling a Go Program
- 3.5 Understanding Packages in Go
- 3.6 Naming Modules in Go
- 3.7 Statically Typed and Dynamically Typed Languages
- 3.7.1 Statically Typed Languages
- 3.7.2 Dynamically Typed Languages
- 3.7.3 Go as a Statically Typed Language
- The fmt Package
- 4.1 Printing to Standard Output
- 4.2 Formatted Printing
- 4.3 Formatting a String
- 4.4 Taking User Input
- Basic Data Types
- 5.1 Integers
- 5.1.1 Signed Integers
- 5.1.2 Unsigned Integers
- 5.2 Floats
- 5.3 Strings
- 5.3.1 Plain String
- 5.3.2 Raw String
- 5.3.3 Runes
- 5.3.4 Playing with Strings
- String Length
- Slicing a String
- Accessing String Characters
- String Concatenation
- Common String Functions
- 5.4 Boolean
- 5.5 Complex Numbers
- 5.5.1 Complex Types in Go
- 5.5.2 Creating Complex Numbers
- 5.5.3 Basic Operations with Complex Numbers
- 5.5.4 Extracting Real and Imaginary Parts
- 5.6 Declaring and Initializing Variables
- 5.6.1 Variables
- 5.6.2 Constants
- 5.6.3 Enumerating Constants
- 5.1 Integers
- Composite Data Types
- 6.1 Array
- 6.1.1 Declaring and Initializing Arrays
- 6.1.2 Accessing and Modifying Array Elements
- 6.1.3 Multidimensional Arrays
- 6.2 Slices
- 6.2.1 Declaring and Initializing Slices
- 6.2.2 Creating a Slice from an Array
- 6.2.3 Modifying Slices
- 6.2.4 Slice Length and Capacity
- 6.2.5 The make Function
- 6.2.6 Slicing Slices
- 6.3 Maps
- 6.3.1 Declaration and Initialization
- 6.4 Structs
- 6.4.1 Defining a Struct
- 6.4.2 Initializing a Struct
- 6.4.3 Anonymous Fields
- 6.4.4 Converting Struct to JSON
- 6.4.5 Converting JSON to Struct
- 6.1 Array
- Control Flow
- 7.1 If-Else
- 7.1.1 Basic if Statement
- 7.1.2 if-else Statement
- 7.1.3 Short Variable Declaration in if Statement
- 7.2 Switch
- 7.2.1 Basic switch Statement
- 7.2.2 switch Without Expression
- 7.2.3 Type Switch
- 7.3 Loops
- 7.3.1 Basic for Loop
- 7.3.2 Using the for Loop as a while Loop
- 7.4 Looping Over Collections
- 7.4.1 Looping Over an Array or Slice
- 7.4.2 Looping Over a Map
- 7.4.3 Looping Over a String
- 7.5 break and continue
- 7.5.1 break Example
- 7.5.2 continue Example
- 7.1 If-Else
- Pointers
- 8.1 Understanding Pointers
- 8.2 Why Use Pointers?
- 8.3 Nil Pointers
- 8.4 Pointers and new
- Functions
- 9.1 Function with No Parameter
- 9.2 Function with Parameters
- 9.3 Function with Multiple Return Values
- 9.4 Variadic Functions
- 9.5 Anonymous Functions and Closures
- 9.6 Deferred Function Calls
- Methods
- 10.1 Defining Methods
- 10.2 Methods with Pointer Receivers
- 10.3 Methods on Different Types
- Generics
- 11.1 Generic Functions
- 11.2 Generic Types
- Interfaces
- 12.1 Understanding Interfaces
- 12.1.1 A Basic Interface
- 12.1.2 Define a Type
- 12.1.3 Implement Interface Methods
- 12.1.4 Working with Interface Implementations
- 12.1.5 Add One More Struct
- 12.2 Concrete Types and Dynamic Types
- 12.2.1 Concrete Types
- 12.2.2 Dynamic Types
- 12.3 Type Assertion
- 12.4 Type Switch
- 12.1 Understanding Interfaces
- Goroutines and Channels
- 13.1 Understanding Goroutines
- 13.2 WaitGroup
- 13.3 Channels
- 13.3.1 Buffered Channels
- 13.3.2 Are Channels Directional?
- 13.3.3 Unbuffered Channels
- 13.3.4 Channel Multiplexing
- 13.4 Sharing Variables Between Goroutines
- 13.4.1 Mutex
- 13.4.2 RWMutex
- 13.4.3 Once
- 13.5 Semaphore
- 13.5.1 Implementing Semaphores in Go
- 13.6 Goroutines vs Threads
- Error Handling
- 14.1 The error Type
- 14.2 Creating and Returning Errors
- 14.3 Custom Error Types
- 14.4 Wrapping Errors
- 14.5 panic and recover
- 14.5.1 Understanding panic
- 14.5.2 Understanding recover
- 14.5.3 When to Use panic and recover
- Testing in Go
- 15.1 Creating Test Files
- 15.2 Types of Functions
- 15.3 The Code Under Test
- 15.4 Test Function
- 15.4.1 Fix the Bug
- 15.5 Benchmark Function
- 15.6 Example Function
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.
You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!
So, there's no reason not to click the Add to Cart button, is there?
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $14 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them