Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
The Go Workshop

You're reading from   The Go Workshop Learn to write clean, efficient code and build high-performance applications with Go

Arrow left icon
Product type Paperback
Published in Dec 2019
Publisher Packt
ISBN-13 9781838647940
Length 824 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (6):
Arrow left icon
Sam Hennessy Sam Hennessy
Author Profile Icon Sam Hennessy
Sam Hennessy
Andrew Hayes Andrew Hayes
Author Profile Icon Andrew Hayes
Andrew Hayes
Gobin Sougrakpam Gobin Sougrakpam
Author Profile Icon Gobin Sougrakpam
Gobin Sougrakpam
Jeremy Leasor Jeremy Leasor
Author Profile Icon Jeremy Leasor
Jeremy Leasor
Delio D'Anna Delio D'Anna
Author Profile Icon Delio D'Anna
Delio D'Anna
Dániel Szabó Dániel Szabó
Author Profile Icon Dániel Szabó
Dániel Szabó
+2 more Show less
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

Preface 1. Variables and Operators FREE CHAPTER 2. Logic and Loops 3. Core Types 4. Complex Types 5. Functions 6. Errors 7. Interfaces 8. Packages 9. Basic Debugging 10. About Time 11. Encoding and Decoding (JSON) 12. Files and Systems 13. SQL and Databases 14. Using the Go HTTP Client 15. HTTP Servers 16. Concurrent Work 17. Using Go Tools 18. Security 19. Special Features Appendix

Summary

In this chapter, we got into the nitty-gritty of variables, including how variables are declared, and all the different notations you can use to declare them. This variety of notation gives you a nice compact notation to use for 90% of your work, while still giving you the power to be very specific when you need to the other 10% of the time. We looked at how to change and update the value of variables after you've declared them. Again, Go gives you some great shorthand to help in the most common use cases to make your life easier. All your data ends up in some form of variable. Data is what makes code dynamic and responsive. Without data, your code could only ever do exactly one thing; data unleashes the true power of software.

Now that your application has data, it needs to make choices based on that data. That's where variable comparison comes in. This helps us see whether something is true or false, bigger or smaller, and to make choices based on the results of those comparisons.

We explored how Go decided to implement their variable system by looking at zero values, pointers, and scope logic. Now, we know that these are the details that can be the difference between delivering bug-free efficient software and not doing so.

We also took a look at how we can declare immutable variables by using constants and how iota can help manage lists or related constants to work, such as enums.

In the next chapter, we'll start to put our variables to work by defining logic and looping over collections of variables.

You have been reading a chapter from
The Go Workshop
Published in: Dec 2019
Publisher: Packt
ISBN-13: 9781838647940
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime