Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Mat Ryer

Rating No ratings yet

Go is the language of the Internet age, and the latest version of Go comes with major architectural changes. Implementation of the language, runtime, and libraries has changed significantly. The compiler and runtime are now written entirely in Go. The garbage collector is now concurrent and provides dramatically lower pause times by running in parallel with other goroutines when possible. This book will show you how to leverage all the latest features and much more. This book shows you how to build powerful systems and drops you into real-world situations. Scale, performance, and high availability lie at the heart of our projects, and the lessons learned throughout this book will arm you with everything you need to build world-class solutions. Each project could form the basis of a start-up, which means they are directly applicable to modern software markets. What you will learn Build quirky and fun projects from scratch while exploring patterns, practices, and techniques, as well as a range of different technologies Create websites and data services capable of massive scale using Gos net/h ttp package, exploring RESTful patterns as well as low-latency WebSocket APIs Interact with a variety of remote web services to consume capabilities ranging from authentication and authorization to a fully functioning thesaurus Develop high-quality command-line tools that utilize the powerful shell capabilities and perform well using Gos in-built concurrency mechanisms Build microservices for larger organizations using the Go Kit library Implement a modern document database as well as high-throughput messaging queue technology to put together an architecture that is truly ready to scale Write concurrent programs and gracefully manage the execution of them and communication by smartly using channels Get a feel for app deployment using Docker and Google App Engine

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A hands-on project-based guide for Go programmers who want to build real-world, scalable systems—from chat apps and OAuth2 authentication to command-line tools and microservices—while learning idiomatic patterns, concurrency, and deployment. 【Book Arc】 - **Opening (~0%–9%)**: Introduces Go's modern architecture (concurrent garbage collector, self-hosted compiler) and sets the stage for building startup-ready projects. The first project, a simple web server with `net/http`, establishes the basics of HTTP handling and templating. - **Early (~9%–28%)**: Builds a chat application with WebSockets, covering client-server communication, room management, and tracing. Then adds user accounts via OAuth2, exploring authentication flows and third-party libraries like `gomniauth` and `goauth2`. - **Early–Middle (~28%–44%)**: Extends the chat app with profile pictures, implementing three avatar strategies (URL-based, file system, and upload form). Emphasizes interface design, test-driven development, and avoiding premature optimization. - **Middle (~44%–47%)**: Shifts to command-line tools for domain name discovery, introducing Unix pipe design (stdin/stdout), and building five small programs (Sprinkle, Domainify, Coolify) that combine into a pipeline. - **Late (~47%–100%)**: Covers advanced topics including microservices with the Go kit framework (gRPC, protocol buffers, bcrypt), document databases, messaging queues, and deployment via Docker and Google App Engine. Excerpts confirm chapter structure but not full details. 【Key Takeaways】 - **Go's modern runtime is built for concurrency** (Opening): The compiler and runtime are now entirely in Go, and the garbage collector runs in parallel with goroutines, reducing pause times—making Go ideal for high-availability systems. - **`net/http` is the foundation for web services** (Early): Using `http.HandleFunc` and `ListenAndServe` to build servers is simple and idiomatic; templates clean up embedded HTML as projects grow. - **WebSockets enable real-time communication** (Early): The chat app demonstrates reading/writing messages via sockets, with channels like `forward` and `send` managing message flow between clients and rooms. - **OAuth2 simplifies third-party authentication** (Early): The flow (redirect, grant code, access token) is handled by libraries like `gomniauth`, letting users sign in with existing credentials without exposing them to your site. - **Interfaces drive flexible design** (Middle): The `Avatar` interface allows multiple implementations (URL, file system, upload) without changing core logic—a lesson in abstraction and testability. - **Command-line tools thrive on pipe design** (Middle): Building small programs that read stdin and write stdout (e.g., Sprinkle, Domainify) enables composability and reuse, a Unix philosophy that scales well. - **Avoid premature optimization** (Middle): An "unexpected optimization" in avatar handling shows that early inefficiencies may not persist; focus on correctness first, then optimize when needed. 【Reading Tips】 - **Skim the Opening (~0–9%)** if you're already familiar with Go basics; focus on the architectural notes about the runtime and garbage collector to understand the language's strengths. - **Deep-read the Early chapters (~9–28%)** for the chat app and OAuth2—these are the most instructive for web development patterns, concurrency, and authentication. Pay attention to test-driven development with `bytes.Buffer` and tracing. - **Hard spot: WebSocket and channel management** (~16–25%): The `read` and `write` methods on clients and rooms can be tricky; trace how messages flow through channels to grasp the concurrency model. - **Skim the Middle (~44–47%)** for command-line tools if you're not interested in shell scripting; but note the pipe design is a reusable pattern for any tool. - **Take away the project-based mindset**: Each chapter builds a complete, deployable system—use the code as templates for your own startups or prototypes, not just exercises. 【Coverage Limits】 This guide synthesizes excerpts from the first ~47% of the book (through command-line tools). Later chapters on microservices, databases, and deployment are referenced in the table of contents but not covered in detail here.
Excerpt 1
oyment using Docker and Google App Engine www.PacktPub.com For support files and downloads related to your book, please visit www.PacktPub.com. For support f...
View in text
Excerpt 2
e nil") } else { tracer.Trace("Hello trace package.") if buf.String() != "Hello trace package.\n" { t.Errorf("Trace should not write '%s'.", buf.String()) }...
View in text
Excerpt 3
little effort. There are online tools that do this for you. After setting the cookie, we redirect the user to the chat page, which we can safely assume was t...
View in text
Excerpt 4
the MD5 hash of Hello: 8b1a9953c4611296a827abf8c47804d7 Our tools will work with lines of strings where each line (separated by a linefeed character) represe...
View in text
Excerpt 5
o start building our components. Reading votes from Twitter In your $GOPATH/src folder, alongside other projects, create a new folder called socialpoll for t...
View in text
Excerpt 6
but this isn't very DRY (Don't Repeat Yourself) and leaves room for potentially erroneous code, such as code that forgets to close a database session once it...
View in text
Excerpt 7
ugh the API. We will give our project the codename Meander. Often on projects in the real world, you are not responsible for the full stack; somebody else bu...
View in text
Excerpt 8
gal as you can't have cyclical dependencies). This may seem like an unnecessary abstraction, but it is actually quite a common pattern and can be seen in the...
View in text
Tags
AI categories
BackendProgramming LanguageGo
ISBN: 1786468948
Publisher: Packt Publishing
Publish Year: 2016
Language: English
File Format: PDF
File Size: 10.6 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…