Title Page Copyright and Credits Go Programming Cookbook Second Edition Dedication About Packt Why subscribe? Contributors About the author About the reviewer Packt is searching for authors like you Preface Who this book is for What this book covers To get the most out of this book Download the example code files Code in Action Conventions used Sections Getting ready How to do it… How it works… There's more… See also Get in touch Reviews I/O and Filesystems Technical requirements Using the common I/O interfaces How to do it... How it works... Using the bytes and strings packages How to do it... How it works... Working with directories and files How to do it... How it works... Working with the CSV format How to do it... How it works... Working with temporary files How to do it... How it works... Working with text/template and html/template How to do it... How it works... Command-Line Tools Technical requirements Using command-line flags How to do it... How it works... Using command-line arguments How to do it... How it works... Reading and setting environment variables How to do it... How it works... Configuration using TOML, YAML, and JSON How to do it... How it works... Working with Unix pipes How to do it... How it works... Catching and handling signals How to do it... How it works... An ANSI coloring application How to do it... How it works... Data Conversion and Composition Technical requirements Converting data types and interface casting How to do it... How it works... Working with numeric data types using math and math/big How to do it... How it works... Currency conversions and float64 considerations How to do it... How it works... Using pointers and SQL NullTypes for encoding and decoding How to do it... How it works... Encoding and decoding Go data How to do it... How it works... Structure tags and basic reflection in Go How to do it... How it works... Implementing collections via closures How to do it... How it works... Error Handling in Go Technical requirements Handling errors and the Error interface How to do it... How it works... Using the pkg/errors package and wrapping errors How to do it... How it works... Using the log package and understanding when to log errors How to do it... How it works... Structured logging with the apex and logrus packages How to do it... How it works... Logging with the context package How to do it... How it works... Using package-level global variables How to do it... How it works... Catching panics for long-running processes How to do it... How it works... Network Programming Technical requirements Writing a TCP/IP echo server and client How to do it... How it works... Writing a UDP server and client How to do it... How it works... Working with domain name resolution How to do it... How it works... Working with WebSockets How to do it... How it works... Working with net/rpc for calling remote methods How to do it... How it works... Using net/mail for parsing emails How to do it... How it works... All about Databases and Storage Using the database/sql package with MySQL Getting ready How to do it... How it works... Executing a database transaction interface Getting ready How to do it... How it works... Connection pooling, rate limiting, and timeouts for SQL Getting ready How to do it... How it works... Working with Redis Getting ready How to do it... How it works... Using NoSQL with MongoDB Getting ready How to do it... How it works... Creating storage interfaces for data portability Getting ready How to do it... How it works... Web Clients and APIs Technical requirements Initializing, storing, and passing http.Client structures How to do it... How it works... Writing a client for a REST API How to do it... How it works... Executing parallel and async client requests How to do it... How it works... Making use of OAuth2 clients Getting ready How to do it... How it works... Implementing an OAuth2 token storage interface Getting ready How to do it... How it works... Wrapping a client in added functionality and function composition How to do it... How it works... Understanding GRPC clients Getting ready How to do it... How it works... Using twitchtv/twirp for RPC Getting ready How to do it... How it works... Microservices for Applications in Go Technical requirements Working with web handlers, requests, and ResponseWriter instances How to do it... How it works... Using structures and closures for stateful handlers How to do it... How it works... Validating input for Go structures and user inputs How to do it... How it works... Rendering and content negotiation How to do it... How it works... Implementing and using middleware How to do it... How it works... Building a reverse proxy application How to do it... How it works... Exporting GRPC as a JSON API Getting ready How to do it... How it works... Testing Go Code Technical requirements Mocking using the standard library How to do it... How it works... Using the Mockgen package to mock interfaces Getting ready How to do it... How it works... Using table-driven tests to improve coverage How to do it... How it works... Using third-party testing tools Getting ready How to do it... How it works... Behavior testing using Go Getting ready How to do it... How it works... Parallelism and Concurrency Technical requirements Using channels and the select statement How to do it... How it works... Performing async operations with sync.WaitGroup How to do it... How it works... Using atomic operations and mutex How to do it... How it works... Using the context package How to do it... How it works... Executing state management for channels How to do it... How it works... Using the worker pool design pattern How to do it... How it works... Using workers to create pipelines How to do it... How it works... Distributed Systems Technical requirements Using service discovery with Consul How to do it... How it works... Implementing basic consensus using Raft How to do it... How it works... Using containerization with Docker Getting ready How to do it... How it works... Orchestration and deployment strategies How to do it... How it works... Monitoring applications How to do it... How it works... Collecting metrics Getting ready How to do it... How it works... Reactive Programming and Data Streams Technical requirements Using Goflow for data flow programming How to do it... How it works... Using Kafka with Sarama Getting ready How to do it... How it works... Using async producers with Kafka Getting ready How to do it... How it works... Connecting Kafka to Goflow Getting ready How to do it... How it works... Writing a GraphQL server in Go How to do it... How it works... Serverless Programming Go programming on Lambda with Apex Getting ready How to do it... How it works... Apex serverless logging and metrics Getting ready How to do it... How it works... Google App Engine with Go Getting ready How to do it... How it works... Working with Firebase using firebase.google.com/go Getting ready How to do it... How it works... Performance Improvements, Tips, and Tricks Technical requirements Using the pprof tool How to do it... How it works... Benchmarking and finding bottlenecks How to do it... How it works... Memory allocation and heap management How to do it... How it works... Using fasthttprouter and fasthttp How to do it... How it works... Other Books You May Enjoy Leave a review - let other readers know what you think