Go Fundamentals: Gopher Guides
- Length: 576 pages
- Edition: 1
- Language: English
- Publisher: Addison-Wesley Professional
- Publication Date: 2022-11-27
- ISBN-10: 0137918305
- ISBN-13: 9780137918300
- Sales Rank: #1971210 (See Top 100 Books)
Start Writing Production-Ready Go Code Fast
Thousands of developers and teams want to start taking advantage of Go, the powerful language used in projects ranging from Kubernetes to Docker and Vault.
Go Fundamentals
is specifically designed to get you up-to-speed fast, to leverage your existing knowledge of other languages, and to help you avoid common mistakes made by Go newcomers.
Based on author Mark Bates’s and Cory LaNou’s pioneering Gopher Guides training curricula, this guide will allow you to quickly understand and use Go syntax, core features, and idioms. Reflecting Go through version 1.18–which includes Go’s exciting new support for generics–this guide prepares you to write robust, reliable, well-performing production code right from the outset.
Learn how Go manages packages, modules, and dependencies Apply Go basics, such as variable declaration, types, and control flow Work effectively with collection types, iteration, functions, structs, and pointers Understand Go Slices and use them properly Write idiomatic Go, using principles such as embedding and composition Expertly use concurrency to improve code performance Create proper tests to quickly identify and fix problems Write simpler, better code with generics and interfaces Take advantage of channels, context, sync primatives, and other advanced features Go is lightweight, simple, and perfect for modern cloud-native and microservices development, which is why Go developers are in such high demand. With this guide and six months’ experience with any modern programming language, you’ll have what you need to leap into Go programming.
Register your book for convenient access to downloads, updates, and/or corrections as they become available. See inside book for details.
Cover Page About This eBook Halftitle Page Title Page Copyright Page Pearson’s Commitment to Diversity, Equity, and Inclusion Dedication Page Contents Foreword Preface How to Read This Book About the Examples Commands and Documentation Summary Acknowledgments About the Authors 1. Modules, Packages, and Dependencies Modules Packages Folders, Files, and Organization Importing Packages and Modules Dependencies Summary 2. Go Language Basics Go Language Overview Numbers Strings UTF-8 Variables Constants Naming Identifiers Printing and Formatting Summary 3. Arrays, Slices, and Iteration List Types: Arrays and Slices How Slices Work Iteration Summary 4. Maps and Control Structures Maps If Statements Switch Statements Summary 5. Functions Function Definitions Variadic Arguments Deferring Function Calls Init Summary 6. Structs, Methods, and Pointers Structs Methods Pointers Nil Receivers Summary 7. Testing Testing Basics Code Coverage Table Driven Testing Running Tests Test Helpers Summary 8. Interfaces Concrete Types versus Interfaces Explicit Interface Implementation Implicit Interface Implementation Before Interfaces Using Interfaces Implementing io.Writer Multiple Interfaces Asserting Interface Implementation The Empty Interface The any Keyword Defining Interfaces Embedding Interfaces Type Assertion Assertions through Switch Using Assertions Summary 9. Errors Errors as Values The error Interface Handling Errors Panic Raising a Panic Recovering from a Panic Don’t Panic Maps Pointers Interfaces Custom Errors Wrapping and Unwrapping Errors Unwrapping Errors Unwrapping Custom Errors To Wrap or Not To Wrap Errors As/Is As Is Stack Traces Summary 10. Generics What Are Generics? Summary 11. Channels Concurrency and Parallelism Go’s Concurrency Model Communicating with Channels Unidirectional Channels Closing Channels Buffered Channels Capturing System Signals with Channels Summary 12. Context The Context Interface Context Rules Context Nodal Hierarchy Context Values Problems with String Keys Securing Context Keys and Values Cancellation Propagation with Contexts Timeouts and Deadlines Context Errors Listening for System Signals with Context Summary 13. Synchronization Waiting for Goroutines with a WaitGroup Error Management with Error Groups Data Races Synchronizing Access with a Mutex Performing Tasks Only Once Summary 14. Working with Files Directory Entries and File Information Walking Directories Skipping Directories and Files Creating Directories and Subdirectories File Path Helpers Creating Multiple Directories Creating Files Fixing the Walk Tests Appending to Files Reading Files Beware of Windows The FS Package Using the FS Interface Mocking a File System Embedding Files Summary Index Code Snippets
Donate to keep this site alive
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.