Hands-on Go Programming
eBook - ePub

Hands-on Go Programming

Learn Google's Golang Programming, Data Structures, Error Handling and Concurrency

Sachchidanand Singh,

Condividi libro
  1. English
  2. ePUB (disponibile sull'app)
  3. Disponibile su iOS e Android
eBook - ePub

Hands-on Go Programming

Learn Google's Golang Programming, Data Structures, Error Handling and Concurrency

Sachchidanand Singh,

Dettagli del libro
Anteprima del libro
Indice dei contenuti
Citazioni

Informazioni sul libro

An easy-to-understand guide that helps you get familiar with the basics and advanced concepts in Golang

Key Features

  • 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.

Description
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.

Table of Contents
1. Chapter 1 Introduction
2. Chapter 2 Functions
3. Chapter 3 Control Flows
4. Chapter 4 Arrays
5. Chapter 5 Slices
6. Chapter 6 Maps
7. Chapter 7 Structs
8. Chapter 8 Methods
9. Chapter 9 Interfaces
10. Chapter 10 Pointers
11. Chapter 11 Concurrency
12. Chapter 12 Error Handling

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

Domande frequenti

Come faccio ad annullare l'abbonamento?
È semplicissimo: basta accedere alla sezione Account nelle Impostazioni e cliccare su "Annulla abbonamento". Dopo la cancellazione, l'abbonamento rimarrà attivo per il periodo rimanente già pagato. Per maggiori informazioni, clicca qui
È possibile scaricare libri? Se sì, come?
Al momento è possibile scaricare tramite l'app tutti i nostri libri ePub mobile-friendly. Anche la maggior parte dei nostri PDF è scaricabile e stiamo lavorando per rendere disponibile quanto prima il download di tutti gli altri file. Per maggiori informazioni, clicca qui
Che differenza c'è tra i piani?
Entrambi i piani ti danno accesso illimitato alla libreria e a tutte le funzionalità di Perlego. Le uniche differenze sono il prezzo e il periodo di abbonamento: con il piano annuale risparmierai circa il 30% rispetto a 12 rate con quello mensile.
Cos'è Perlego?
Perlego è un servizio di abbonamento a testi accademici, che ti permette di accedere a un'intera libreria online a un prezzo inferiore rispetto a quello che pagheresti per acquistare un singolo libro al mese. Con oltre 1 milione di testi suddivisi in più di 1.000 categorie, troverai sicuramente ciò che fa per te! Per maggiori informazioni, clicca qui.
Perlego supporta la sintesi vocale?
Cerca l'icona Sintesi vocale nel prossimo libro che leggerai per verificare se è possibile riprodurre l'audio. Questo strumento permette di leggere il testo a voce alta, evidenziandolo man mano che la lettura procede. Puoi aumentare o diminuire la velocità della sintesi vocale, oppure sospendere la riproduzione. Per maggiori informazioni, clicca qui.
Hands-on Go Programming è disponibile online in formato PDF/ePub?
Sì, puoi accedere a Hands-on Go Programming di Sachchidanand Singh, in formato PDF e/o ePub, così come ad altri libri molto apprezzati nelle sezioni relative a Computer Science e Open Source Programming. Scopri oltre 1 milione di libri disponibili nel nostro catalogo.

Informazioni

Anno
2021
ISBN
9789389898194

CHAPTER 1

Introduction

The Go programming language was conceived by Robert Griesemer, Rob Pike, and Ken Thompson in 2007 at Google. It’s an open-source, general-purpose programming language that supports high-performance networking and multiprocessing. The Go compiler was initially written in C but it is now written in Go itself.

Structure

  • Data types
  • Constants, variables, and operators
  • Typed constants and untyped constants
  • Multiple constant declarations
  • Redeclaration concept
  • Reassignment concept
  • Code structure

Objective

This chapter covers the basic concepts of data types, constants, variables, operators, reassignment, and redeclaration. You will learn how to use them in the Go programming language.

Introduction

Go is a systems-level programming language for large distributed systems and highly scalable network servers. It’s well-suited for building infrastructures like networked servers and tools and is suitable for cloud, mobile applications, machine learning, etc. Go provides efficient concurrency, flexible approach to data abstraction, and supports automatic memory management, i.e., garbage collection.

Why Go programming?

Multithreading is supported by most of the programming languages, but race conditions and deadlocks create difficulties in creating the multithreaded application. For example, creating a new thread in Java consumes approximately 1 MB of the memory heap size. Now, consider a case wherein you need to spin thousands of such threads. Then, it will create out of memory.
Moreover, there is a limit to the number of cores you can add to the processors like quad-core and octa-core to increase processing power. You cannot keep on adding more cache to the processor in order to boost performance since there is a cost involved. Therefore, we are left with only one option to build a more efficient software having high performance.
Go provides a solution to the problem with goroutines. You can spin millions of them at a time since they consume ~2KB heap memory. Goroutines have faster startup time and they use more memory on a need basis only. Also, a single goroutine can run on multiple threads since goroutines and OS threads don’t have 1:1 mapping.

1.1 Data types

Data types categorize a set of related values and describe the operations that can be performed.

1.1.1 Numeric types

They are arithmetic types and represent either integer types or floating-point values.
Integer types:
uint8
Unsigned 8-bit integers (0 to 255)
uint16
Unsigned 16-bit integers (0 to 65535)
uint32
Unsigned 32-bit integers (0 to 4294967295)
uint64
Unsigned 64-bit integers (0 to 18446744073709551615)
int8
Signed 8-bit integers (-128 to 127)
int16
Signed 16-bit integers (-32768 to 32767)
int32
Signed 32-bit integers (-2147483648 to 2147483647)
int64
Signed 64-bit integers (-9223372036854775808 to 9223372036854775807)
Table 1.1
Float types:
float32
IEEE-754 32-bit floating-point numbers
float64
IEEE-754 64-bit floating-point numbers
complex64
Complex numbers with float32 real and imaginary parts
complex128
Complex numbers with float64 real and imaginary parts
Table 1.2

1.1.2 String types

Strings are immutable types. This means that once created, you can’t change the contents of a string. Go supports two styles of string literals: the double-quote style and the back-quote style.
String literals can be created using double quotes, "Go Programming" or backticks, 'Go Programming'. With regular double-quoted strings, the special...

Indice dei contenuti