Hands-on Go Programming
eBook - ePub

Hands-on Go Programming

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

Sachchidanand Singh,

Compartir libro
  1. English
  2. ePUB (apto para móviles)
  3. Disponible en iOS y Android
eBook - ePub

Hands-on Go Programming

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

Sachchidanand Singh,

Detalles del libro
Vista previa del libro
Índice
Citas

Información del 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

Preguntas frecuentes

¿Cómo cancelo mi suscripción?
Simplemente, dirígete a la sección ajustes de la cuenta y haz clic en «Cancelar suscripción». Así de sencillo. Después de cancelar tu suscripción, esta permanecerá activa el tiempo restante que hayas pagado. Obtén más información aquí.
¿Cómo descargo los libros?
Por el momento, todos nuestros libros ePub adaptables a dispositivos móviles se pueden descargar a través de la aplicación. La mayor parte de nuestros PDF también se puede descargar y ya estamos trabajando para que el resto también sea descargable. Obtén más información aquí.
¿En qué se diferencian los planes de precios?
Ambos planes te permiten acceder por completo a la biblioteca y a todas las funciones de Perlego. Las únicas diferencias son el precio y el período de suscripción: con el plan anual ahorrarás en torno a un 30 % en comparación con 12 meses de un plan mensual.
¿Qué es Perlego?
Somos un servicio de suscripción de libros de texto en línea que te permite acceder a toda una biblioteca en línea por menos de lo que cuesta un libro al mes. Con más de un millón de libros sobre más de 1000 categorías, ¡tenemos todo lo que necesitas! Obtén más información aquí.
¿Perlego ofrece la función de texto a voz?
Busca el símbolo de lectura en voz alta en tu próximo libro para ver si puedes escucharlo. La herramienta de lectura en voz alta lee el texto en voz alta por ti, resaltando el texto a medida que se lee. Puedes pausarla, acelerarla y ralentizarla. Obtén más información aquí.
¿Es Hands-on Go Programming un PDF/ePUB en línea?
Sí, puedes acceder a Hands-on Go Programming de Sachchidanand Singh, en formato PDF o ePUB, así como a otros libros populares de Computer Science y Open Source Programming. Tenemos más de un millón de libros disponibles en nuestro catálogo para que explores.

Información

Año
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...

Índice