Cover
Copyright
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Table of Contents
Preface
Chapter 1: I/O and File Systems
Introduction
Using the common I/O interfaces
Getting ready
How to do it...
How it works...
Using the bytes and strings packages
Getting ready
How to do it...
How it works...
Working with directories and files
Getting ready
How to do it...
How it works...
Working with the CSV format
Getting ready
How to do it...
How it works...
Working with temporary files
Getting ready
How to do it...
How it works...
Working with text/template and HTML/templates
Getting ready
How to do it...
How it works...
Chapter 2: Command-Line Tools
Introduction
Using command-line flags
Getting ready
How to do it...
How it works...
Using command-line arguments
Getting ready
How to do it...
How it works...
Reading and setting environment variables
Getting ready
How to do it...
How it works...
Configuration using TOML, YAML, and JSON
Getting ready
How to do it...
How it works...
Working with Unix pipes
Getting ready
How to do it...
How it works...
Catching and handling signals
Getting ready
How to do it...
How it works...
An ANSI coloring application
Getting ready
How to do it...
How it works...
Chapter 3: Data Conversion and Composition
Introduction
Converting data types and interface casting
Getting ready
How to do it...
How it works...
Working with numeric data types using math and math/big
Getting ready
How to do it...
How it works...
Currency conversions and float64 considerations
Getting ready
How to do it...
How it works...
Using pointers and SQL NullTypes for encoding and decoding
Getting ready
How to do it...
How it works...
Encoding and decoding Go data
Getting ready
How to do it...
How it works...
Struct tags and basic reflection in Go
Getting ready
How to do it...
How it works...
Implementing collections via closures
Getting ready
How to do it...
How it works...
Chapter 4: Error Handling in Go
Introduction
Handling errors and the Error interface
Getting ready
How to do it...
How it works...
Using the pkg/errors package and wrapping errors
Getting ready
How to do it...
How it works...
Using the log package and understanding when to log errors
Getting ready
How to do it...
How it works...
Structured logging with the apex and logrus packages
Getting ready
How to do it...
How it works...
Logging with the context package
Getting ready
How to do it...
How it works...
Using package-level global variables
Getting ready
How to do it...
How it works...
Catching panics for long running processes
Getting ready
How to do it...
How it works...
Chapter 5: All about Databases and Storage
Introduction
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 and mgo
Getting ready
How to do it...
How it works...
Creating storage interfaces for data portability
Getting ready
How to do it...
How it works...
Chapter 6: Web Clients and APIs
Introduction
Initializing, storing, and passing http.Client structs
Getting ready
How to do it...
How it works...
Writing a client for a REST API
Getting ready
How to do it...
How it works...
Executing parallel and async client requests
Getting ready
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
Getting ready
How to do it...
How it works...
Understanding GRPC clients
Getting ready
How to do it...
How it works...
Chapter 7: Microservices for Applications in Go
Introduction
Working with web handlers, requests, and ResponseWriters
Getting ready
How to do it...
How it works...
Using structs and closures for stateful handlers
Getting ready
How to do it...
How it works...
Validating input for Go structs and user inputs
Getting ready
How to do it...
How it works...
Rendering and content negotiation
Getting ready
How to do it...
How it works...
Implementing and using middleware
Getting ready
How to do it...
How it works...
Building a reverse proxy application
Getting ready
How to do it...
How it works...
Exporting GRPC as a JSON API
Getting ready
How to do it...
How it works...
Chapter 8: Testing
Introduction
Mocking using the standard library
Getting ready
How to do it...
How it works...
Using the Mockgen package
Getting ready
How to do it...
How it works...
Using table-driven tests to improve coverage
Getting ready
How to do it...
How it works...
Using third-party testing tools
Getting ready
How to do it...
How it works...
Practical fuzzing
Getting ready
How to do it...
How it works...
Behavior testing using Go
Getting ready
How to do it...
How it works...
Chapter 9: Parallelism and Concurrency
Introduction
Using channels and the select statement
Getting ready
How to do it...
How it works...
Performing async operations with sync.WaitGroup
Getting ready
How to do it...
How it works...
Using atomic operations and mutex
Getting ready
How to do it...
How it works...
Using the context package
Getting ready
How to do it...
How it works...
Executing state management for channels
Getting ready
How to do it...
How it works...
Using the worker pool design pattern
Getting ready
How to do it...
How it works...
Using workers to create pipelines
Getting ready
How to do it...
How it works...
Chapter 10: Distributed Systems
Introduction
Using service discovery with Consul
Getting ready
How to do it...
How it works...
Implementing basic consensus using Raft
Getting ready
How to do it...
How it works...
Using containerization with Docker
Getting ready
How to do it...
How it works...
Orchestration and deployment strategies
Getting ready
How to do it...
How it works...
Monitoring applications
Getting ready
How to do it...
How it works...
Collecting metrics
Getting ready
How to do it...
How it works...
Chapter 11: Reactive Programming and Data Streams
Introduction
Goflow for dataflow programming
Getting ready
How to do it...
How it works...
Reactive programming with RxGo
Getting ready
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
Getting ready
How to do it...
How it works...
Chapter 12: Serverless Programming
Introduction
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 zabawaba99/firego
Getting ready
How to do it...
How it works...
Chapter 13: Performance Improvements, Tips, and Tricks
Introduction
Speeding up compilation and testing cycles
Getting ready
How to do it...
How it works...
Using the pprof tool
Getting ready
How to do it...
How it works...
Benchmarking and finding bottlenecks
Getting ready
How to do it...
How it works...
Memory allocation and heap management
Getting ready
How to do it...
How it works...
Vendoring and project layout
Getting ready
How to do it...
How it works...
Using fasthttprouter and fasthttp
Getting ready
How to do it...
How it works...
Index