Hands-on Go Programming: Learn Google’s Golang Programming, Data Structures, Error Handling and Concurrency
An easy-to-understand guide that helps you get familiar with the basics and advanced concepts in Golang
- Everything you need to know on how to use Go programming.
- Illustrated Examples on Go Functions, Control Flows, and Arrays.
Deep Dive into Slices, Maps, Structs, Error Handling and Concurrency in Golang.
Hands-on Go Programming is designed to get you up and running as fast as possible with Go. You will not just learn the basics but get introduced to how to use advanced features of Golang.
The book begins with the basic concepts of Data types, Constants, Variables, Operators, Reassignment, and Redeclaration. Moving ahead, we explore and learn the use of Functions, Control flows, Arrays, Slices, Maps, and Structs using some great examples and illustrations. We then get to know about Methods in Golang. Furthermore, we learn about complex aspects of Golang such as Interfaces,Pointers, Concurrency and Error Handling.
By the end, you will be familiar with both the basics and advanced concepts of Go and start developing critical programs working using this language.
What you will learn
- Learn Golang syntaxes, control structures and Error Handling in-depth.
- Learn to declare, create and modify Slices, Maps and Struct in Go.
- Build your own concurrent programs with Goroutines and Channels.
- Deep Dive into Error handling in Golang.
Who this book is for
Anyone who knows basic programming can use this book to upskill themselves in Golang. This book is also for Engineering students, IT/Software professionals, and existing Go programmers. Architects and Developers working in Cloud, Networking, and DevOps can use this book to learn Go programming and apply the knowledge gained to design and build solutions in their respective domains.
About the Author
Sachchidanand Singh is Advanced Analytics, BI and Data Science SME at IBM India Software Labs (ISL), Pune. He is M.Tech from Birla Institute of Technology and Science (BITS), Pilani. He has authored more than a dozen technical research papers in IEEE, international computer journals, and national/international conferences. He holds several Patents in Artificial Intelligence, Machine Learning, Cloud, and Cognitive domain. Having rich experience in architecture design and solution implementation with technologies like Advanced Analytics and Business Intelligence (BI). He is an IEEE reviewer, Technical Program Committee (TPC) member of various national/international conferences, and review board members of the American Journal of Computer Science and Information.
LinkedIn Profile: www.linkedin.com/in/sachchidanand-singh-67908018
Prithvipal Singh has been working in the IT industry for nearly a decade. He has vast experience working in Java, Golang, Spring, Node.js, and Python. He has expertise in microservice architecture and the cloud domain. He is MCA from Savitribai Phule Pune University.
LinkedIn Profile: www.linkedin.com/in/prithvipal-singh-2a7b4b49
Cover Page Title Page Copyright Page Dedication Page About the Authors About the Reviewer Acknowledgements Preface Errata Table of Contents 1. Introduction Structure Objective Introduction Why Go programming? 1.1 Data types 1.1.1 Numeric types 1.1.2 String types 1.1.3 Boolean types 1.1.4 Derived types 1.2 Constants 1.2.1 Variable declaration 1.2.2 Short variable declaration 1.3 Operator 1.3.1 Arithmetic operators 1.3.2 Relational operators 1.3.3 Logical operators 1.3.4 Bitwise operators 1.3.5 Assignment operators 1.4 Typed constants and untyped constants 1.4.1 Typed constants 1.4.2 Untyped constants 1.5 Multiple constant declarations 1.6 Redeclaration concept 1.7 Reassignment concept 1.8 Code structure Conclusion Questions 2. Functions Structure Objective 2.1 Function 2.1.1 Function declarations 2.2 Parameters and returns 2.2.1 Parameters 2.2.2 Returns 2.3 Multiple returns and named return 2.3.1 Multiple returns 2.3.2 Named returns 2.4 Call by value 2.4.1 Call by value 2.5 Variadic functions 2.6 Defer 2.6.1 Defer Conclusion Questions 3. Control flows Structure Objective 3.1 Decision-making 3.1.1 If statement 3.1.2 if…else statement 3.1.3 if...else if...else statement 3.1.4 switch...case 3.2 Loops 3.2.1 For loops 3.2.2 Nested for loops 3.2.3 Loop control statements 126.96.36.199 Break statements 188.8.131.52 Goto statements 184.108.40.206 Continue statements 220.127.116.11 Infinite loop 18.104.22.168 Fallthrough Conclusion Questions 4. Arrays Structure Objective 4.1 Arrays 4.2 Array declaration 4.2.1 Using var keyword 4.2.2 Shorthand declaration 4.3 Array initialization 4.4 2D and 3D array 4.5 Array iteration 4.6 Passing arrays to functions Conclusion Questions 5. Slices Structure Objective 5.1 Concept of slices 5.2 Declaration of slice 5.3 Creating a slice 5.3.1 Creating a slice using a slice literal 5.3.2 Creating a slice from an array 5.3.3 Creating a slice from another slice 5.3.4 Create slice using make() function 5.4 Modifying a Slice 5.5 Zero-value slice 5.6 Comparison of slice 5.7 Multi-dimensional Slice 5.8 Sorting of slice 5.9 Iterate over a slice 5.9.1 Iterate over a slice using for loop 5.9.2 Iterate over a slice using a range in for loop Conclusion Questions 6. Maps Structure Objective 6.1 What are Go maps? 6.2 Declaration of Go maps 6.3 Initialization of Go Maps 6.3.1 Initializing maps using map literal 6.3.2 Initializing a map using make() function 6.4 Iterating over Go maps 6.5 Adding key-value pairs in maps 6.6 Updating key-value pairs in maps 6.7 Retrieving the value of a key in maps 6.8 Checking if a key exists in Go maps 6.9 Deletion of a key from maps 6.10 Maps are reference types Conclusion Questions 7. Structs Structure Objective 7.1 What are structs? 7.2 Declaring and initializing structs type 7.3 Zero value of structs 7.4 Access fields of structs 7.5 Pointer to structs 7.5.1 Updating value of struct member using pointer 7.6 Exported vs. unexported structs and struct fields 7.7 Structs are value types 7.8 Struct equality Conclusion Questions 8. Methods Structure Objective 8.1 Definition 8.2 Value receiver and pointer receiver 8.3 Methods of different types 8.3.1 Method on the basic type 8.3.2 Method on composite types 8.3.3 Method on the function type 8.4 Methods of embedded type 8.4.1 Method resolution process 8.4.2 Polymorphism is not allowed Conclusion Questions 9. Interfaces Structure Objective 9.1 Introduction 9.2 Implementing an interface 9.2.1 Why implicit implementation? 9.2.2 Polymorphism: Interface as a contract 9.3 Empty interface 9.4 Method set Conclusion of method set: 9.5 Frequently used built-in/stdlib interfaces 9.5.1 Stringer interface 9.5.2 Interface interface of sort package 9.6 Interface with struct 9.6.1 Interface variable as struct field 9.6.2 Embedding interface into the struct Conclusion Questions 10. Pointers Structure Objective 10.1 Declaration 10.2 Pointer type 10.3 Operators with the pointer 10.3.1 Relational operator 10.3.2 Arithmetic operator 10.4 Pointers on composite types 10.4.1 Pointer to array 10.4.1.1 Declaration 10.4.1.2 Pointer array as a function argument 10.4.2 Pointer to slice 10.4.3 Pointer to struct Conclusion Questions 11. Concurrency Structure Objectives 11.1 Goroutines 11.1.1 Introduction 11.1.2 WaitGroup 11.1.3 Mutex Lock 11.2 Some important functions 11.2.1 The GOMAXPROCS functions 11.2.2 The Goexit function 11.3 Channels 11.3.1 Introduction 11.3.2 Operations on channel 22.214.171.124 Closing the channel 126.96.36.199 Iterating over the channel 11.3.3 Types of channels 188.8.131.52 Unbuffered channel 184.108.40.206 Buffered channel 11.4 Read-only and send-only channel 11.5 Select statement 11.6 Channels in the time package 11.6.1 Ticker 11.6.2 Timer Conclusion Questions 12. Error handling Structure Objective 12.1 The error 12.1.1 The error interface 12.1.2 User-defined custom error 12.2 Panic 12.2.1 Panic and defer 12.3 Recover 12.4 Best practice Conclusion Questions Index
1. Disable the AdBlock plugin. Otherwise, you may not get any links.
2. Solve the CAPTCHA.
3. Click download link.
4. Lead to download server to download.