Go Fundamentals: Gopher Guides, 1st edition
BRAND: PEARSON
eBook edition. 1 Year Subscription. Dành cho Cá nhân | Trường ĐH, Nhóm, Thư Viện: Gọi 0915920514 để báo giá Pearson, Vital Source eBook hoặc mua Sách In
Tổng quan sách
Hàng nghìn nhà phát triển và nhóm muốn bắt đầu tận dụng Go, ngôn ngữ mạnh mẽ được sử dụng trong các dự án từ Kubernetes đến Docker và Vault. Go Fundamentals được thiết kế đặc biệt để giúp bạn bắt kịp tốc độ nhanh chóng, tận dụng kiến thức hiện có của bạn và giúp bạn tránh những lỗi phổ biến mà những người mới chơi Go thường mắc phải. Dựa trên chương trình đào tạo Gopher Guides tiên phong của tác giả, nó sẽ giúp bạn:Nhanh chóng hiểu, đọc và sử dụng cú pháp GoLàm việc hiệu quả với các kiểu bộ sưu tập, phép lặp, hàm, cấu trúc và con trỏHiểu nội bộ của Go Slices và tìm hiểu cách sử dụng chúng đúng cáchViết thành ngữ Sử dụng các nguyên tắc cốt lõi như nhúng và giao diệnĐạt được sự hiểu biết sâu sắc về tính đồng thời của Go, để viết mã mạnh mẽ hơn, hoạt động tốt hơnTạo các bài kiểm tra thích hợp, bao gồm kiểm tra bảng, để nhanh chóng xác định và khắc phục sự cốTận dụng các kênh, bối cảnh, khái quát, tạo khuôn mẫu và các tính năng phức tạp khácXây dựng ứng dụng web với HTTP và HTML, v.v.Covers Go 1.18 và Generics
- Foreword xxiPreface xxiiiAcknowledgments xxxiAbout the Authors xxxv
- Chapter 1: Modules, Packages, and Dependencies 1Modules 1Packages 4Folders, Files, and Organization 6Importing Packages and Modules 13Dependencies 16Summary 25
- Chapter 2: Go Language Basics 27Go Language Overview 27Numbers 31Strings 35UTF-8 37Variables 40Constants 48Naming Identifiers 51Printing and Formatting 57Summary 75
- Chapter 3: Arrays, Slices, and Iteration 77List Types: Arrays and Slices 77How Slices Work 90Iteration 104Summary 110
- Chapter 4: Maps and Control Structures 111Maps 111If Statements 129Switch Statements 135Summary 140
- Chapter 5: Functions 141Function Definitions 141Variadic Arguments 151Deferring Function Calls 156Init 162Summary 166
- Chapter 6: Structs, Methods, and Pointers 167Structs 167Methods 176Pointers 182Nil Receivers 191Summary 193
- Chapter 7: Testing 195Testing Basics 195Code Coverage 202Table Driven Testing 206Running Tests 213Test Helpers 222Summary 229
- Chapter 8: Interfaces 231Concrete Types versus Interfaces 231Explicit Interface Implementation 233Implicit Interface Implementation 234Before Interfaces 235Using Interfaces 237Implementing io.Writer 239Multiple Interfaces 241Asserting Interface Implementation 241The Empty Interface 242Defining Interfaces 243Embedding Interfaces 249Type Assertion 250Assertions through Switch 252Using Assertions 255Summary 257
- Chapter 9: Errors 259Errors as Values 259Panic 264Don't Panic 273Custom Errors 289Wrapping and Unwrapping Errors 294Errors As/Is 301Stack Traces 307Summary 309
- Chapter 10: Generics 311What Are Generics? 311Summary 334
- Chapter 11: Channels 335Concurrency and Parallelism 335Go's Concurrency Model 338Communicating with Channels 342Unidirectional Channels 351Closing Channels 352Buffered Channels 358Capturing System Signals with Channels 363Summary 371
- Chapter 12: Context 373The Context Interface 374Context Rules 380Context Nodal Hierarchy 381Context Values 384Problems with String Keys 388Securing Context Keys and Values 393Cancellation Propagation with Contexts 396Timeouts and Deadlines 405Context Errors 408Listening for System Signals with Context 411Summary 416
- Chapter 13: Synchronization 419Waiting for Goroutines with a WaitGroup 419Error Management with Error Groups 433Data Races 443Synchronizing Access with a Mutex 447Performing Tasks Only Once 459Summary 466
- Chapter 14: Working with Files 467Directory Entries and File Information 467Walking Directories 473Skipping Directories and Files 477Creating Directories and Subdirectories 481File Path Helpers 484Creating Multiple Directories 489Creating Files 492Fixing the Walk Tests 497Appending to Files 500Reading Files 503Beware of Windows 505The FS Package 506Using the FS Interface 510Mocking a File System 513Embedding Files 517Summary 522Index 523
