Book Image

Mastering Go

By : Mihalis Tsoukalos
Book Image

Mastering Go

By: Mihalis Tsoukalos

Overview of this book

<p>Often referred to as Golang (albeit wrongly), the Go programming language is really making strides thanks to some masterclass developments, architected by the greatest programming minds. Shopify CEO Tobias Lutke has been recently quoted as saying “Go will be the server language of the future.” Go programmers are in high demand, but - more controversially - Go takes the stage where C and Unix programmers previously led the way.</p> <p>The growth of the Go language has seen it become the means by which systems, networking, web, and cloud applications are implemented. If you’re a Go programmer, you’ll already know some Go syntax and will have written some small projects. However, most Go programmers face the difficulty of having to integrate their Golang skills with production code. With Mastering Go, the author shows you just how to tackle this problem. You'll benefit by mastering the use of the libraries and utilize its features, speed, and efficiency for which the Go ecology is justly famous.</p> <p>Offering a compendium of Go, the book begins with an account of how Go has been implemented. You'll also benefit from an in-depth account of concurrency and systems and network programming imperative for modern-day native cloud development through the course of the book.</p>
Table of Contents (19 chapters)
Title Page
Packt Upsell
Contributors
Preface
Index

Why are we using binary format?


In the previous section, the readSize.go utility illustrated how you can read a file byte by byte, which is a technique that best applies to binary files. So, you might ask why read data in binary format when text formats are so much easier to understand? The main reason is space reduction. Imagine that you want to store the number 20 as a string to a file. It is easy to understand that you will need two bytes for storing 20 using ASCII characters, one for storing 2 and another for storing 0. Storing 20 in binary format requires just one byte, since 20 can be represented as 00010100 in binary or as 0x14 in hexadecimal.

This difference might look insignificant when you are dealing with small amounts of data, but it could be pretty substantial when dealing with data found in applications such as database servers.