,

Go Fundamentals

Gopher Guides

Paperback Engels 2023 9780137918300
Verwachte levertijd ongeveer 9 werkdagen

Samenvatting

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.

Specificaties

ISBN13:9780137918300
Taal:Engels
Bindwijze:Paperback

Lezersrecensies

Wees de eerste die een lezersrecensie schrijft!

Inhoudsopgave

<p>Foreword xxi<br>Preface xxiii<br>Acknowledgments xxxi<br>About the Authors xxxv</p> <p><strong>Chapter 1: Modules, Packages, and Dependencies 1</strong><br>Modules 1<br>Packages 4<br>Folders, Files, and Organization 6<br>Importing Packages and Modules 13<br>Dependencies 16<br>Summary 25</p> <p><strong>Chapter 2: Go Language Basics 27</strong><br>Go Language Overview 27<br>Numbers 31<br>Strings 35<br>UTF-8 37<br>Variables 40<br>Constants 48<br>Naming Identifiers 51<br>Printing and Formatting 57<br>Summary 75</p> <p><strong>Chapter 3: Arrays, Slices, and Iteration 77</strong><br>List Types: Arrays and Slices 77<br>How Slices Work 90<br>Iteration 104<br>Summary 110</p> <p><strong>Chapter 4: Maps and Control Structures 111</strong><br>Maps 111<br>If Statements 129<br>Switch Statements 135<br>Summary 140</p> <p><strong>Chapter 5: Functions 141</strong><br>Function Definitions 141<br>Variadic Arguments 151<br>Deferring Function Calls 156<br>Init 162<br>Summary 166</p> <p><strong>Chapter 6: Structs, Methods, and Pointers 167</strong><br>Structs 167<br>Methods 176<br>Pointers 182<br>Nil Receivers 191<br>Summary 193</p> <p><strong>Chapter 7: Testing 195</strong><br>Testing Basics 195<br>Code Coverage 202<br>Table Driven Testing 206<br>Running Tests 213<br>Test Helpers 222<br>Summary 229</p> <p><strong>Chapter 8: Interfaces 231</strong><br>Concrete Types versus Interfaces 231<br>Explicit Interface Implementation 233<br>Implicit Interface Implementation 234<br>Before Interfaces 235<br>Using Interfaces 237<br>Implementing io.Writer 239<br>Multiple Interfaces 241<br>Asserting Interface Implementation 241<br>The Empty Interface 242<br>Defining Interfaces 243<br>Embedding Interfaces 249<br>Type Assertion 250<br>Assertions through Switch 252<br>Using Assertions 255<br>Summary 257</p> <p><strong>Chapter 9: Errors 259</strong><br>Errors as Values 259<br>Panic 264<br>Don't Panic 273<br>Custom Errors 289<br>Wrapping and Unwrapping Errors 294<br>Errors As/Is 301<br>Stack Traces 307<br>Summary 309</p> <p><strong>Chapter 10: Generics 311</strong><br>What Are Generics? 311<br>Summary 334</p> <p><strong>Chapter 11: Channels 335</strong><br>Concurrency and Parallelism 335<br>Go's Concurrency Model 338<br>Communicating with Channels 342<br>Unidirectional Channels 351<br>Closing Channels 352<br>Buffered Channels 358<br>Capturing System Signals with Channels 363<br>Summary 371</p> <p><strong>Chapter 12: Context 373</strong><br>The Context Interface 374<br>Context Rules 380<br>Context Nodal Hierarchy 381<br>Context Values 384<br>Problems with String Keys 388<br>Securing Context Keys and Values 393<br>Cancellation Propagation with Contexts 396<br>Timeouts and Deadlines 405<br>Context Errors 408<br>Listening for System Signals with Context 411<br>Summary 416</p> <p><strong>Chapter 13: Synchronization 419</strong><br>Waiting for Goroutines with a WaitGroup 419<br>Error Management with Error Groups 433<br>Data Races 443<br>Synchronizing Access with a Mutex 447<br>Performing Tasks Only Once 459<br>Summary 466</p> <p><strong>Chapter 14: Working with Files 467</strong><br>Directory Entries and File Information 467<br>Walking Directories 473<br>Skipping Directories and Files 477<br>Creating Directories and Subdirectories 481<br>File Path Helpers 484<br>Creating Multiple Directories 489<br>Creating Files 492<br>Fixing the Walk Tests 497<br>Appending to Files 500<br>Reading Files 503<br>Beware of Windows 505<br>The FS Package 506<br>Using the FS Interface 510<br>Mocking a File System 513<br>Embedding Files 517<br>Summary 522</p> <p>Index 523</p>

Managementboek Top 100

Rubrieken

    Personen

      Trefwoorden

        Go Fundamentals