更新时间:2021-06-24 18:36:41
coverpage
Title Page
Packt Upsell
Why subscribe?
PacktPub.com
Contributors
About the author
About the reviewers
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
Download the color images
Conventions used
Get in touch
Reviews
Developer Environment for Go
GOROOT
GOPATH
src/
pkg/
bin/
Package management
go get
glide
go dep
Structuring a project
Working with book's code
Containers
Docker
Docker versus Virtual Machine (VM)
Understanding Docker
Testing Docker setup
Dockerfile
main.go
Testing in Go
variadic.go
variadic_test.go
Running tests in variadic_test.go
addInt.go
addInt_test.go
Running tests in addInt_test.go
nil_test.go
Running tests in nil_test.go
Summary
Understanding Goroutines
Concurrency and parallelism
Concurrency
Code overview
Serial task execution
Serial task execution with goroutines
Concurrent task execution
Parallelism
Go's runtime scheduler
Goroutine
OS thread or machine
Context or processor
Scheduling with G M and P
Gotchas when using goroutines
Single goroutine halting the complete program
Goroutines aren't predictable
Channels and Messages
Controlling parallelism
Distributed work without channels
Distributed work with channels
What is a channel?
Solving the cashier problem with goroutines
Channels and data communication
Messages and events
Types of channels
The unbuffered channel
The buffered channel
The unidirectional buffer
Closing channels
Multiplexing channels
The RESTful Web
HTTP and sessions
A brief history of HTTP
HTTP sessions
The REST protocol
The server and client architecture
The standard data format
Resources
Reusing the HTTP protocol
GET
POST
PUT and PATCH
DELETE
Upgradable components
Fundamentals of a REST server
A simple web server
Designing a REST API
The data format
The book resource
GET /api/books
GET /api/books/<id>