售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Title Page
Copyright and Credits
Go Standard Library Cookbook
Packt Upsell
Why subscribe?
PacktPub.com
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
Conventions used
Sections
Getting ready
How to do it…
How it works…
There's more…
See also
Get in touch
Reviews
Interacting with the Environment
Introduction
Retrieving the Golang version
Getting ready
How to do it...
How it works...
Accessing program arguments
How to do it...
How it works...
There's more…
Creating a program interface with the flag package
How to do it...
How it works…
There's more…
Getting and setting environment variables with default values
How to do it…
How it works…
Retrieving the current working directory
How to do it...
How it works…
Getting the current process PID
How to do it…
How it works…
Handling operating system signals
How to do it…
How it works…
Calling an external process
Getting ready
How to do it…
How it works…
See also
Retrieving child process information
Getting ready
How to do it…
How it works…
See also
Reading/writing from the child process
Getting ready
How to do it…
How it works…
Shutting down the application gracefully
How to do it…
How it works…
See also
File configuration with functional options
How to do it...
How it works...
Strings and Things
Introduction
Finding the substring in a string
How to do it...
How it works...
See also
Breaking the string into words
How to do it...
How it works...
There's more...
Joining the string slice with a separator
How to do it...
How it works...
There's more...
Concatenating a string with writer
How to do it...
How it works...
There's more...
Aligning text with tabwriter
How to do it...
How it works...
Replacing part of the string
How to do it...
How it works...
There's more...
Finding the substring in text by the regex pattern
How to do it...
How it works...
See also
Decoding a string from the non-Unicode charset
How to do it...
How it works...
Controlling case
How to do it...
How it works...
Parsing comma-separated data
How to do it...
How it works...
Managing whitespace in a string
How to do it...
How it works...
See also
Indenting a text document
How to do it...
How it works...
See also
Dealing with Numbers
Introduction
Converting strings to numbers
How to do it...
How it works...
Comparing floating-point numbers
How to do it...
How it works...
Rounding floating-point numbers
How to do it...
How it works...
Floating-point arithmetics
How to do it...
How it works...
There's more...
See also
Formatting numbers
How to do it...
How it works...
There's more...
Converting between binary, octal, decimal, and hexadecimal
How to do it...
How it works...
Formatting with the correct plurals
Getting ready
How to do it...
How it works...
There's more...
Generating random numbers
How to do it...
How it works...
Operating complex numbers
How to do it...
How it works...
Converting between degrees and radians
How to do it...
How it works...
Taking logarithms
How to do it...
How it works...
Generating checksums
How to do it...
How it works...
Once Upon a Time
Introduction
Finding today's date
How to do it...
How it works...
See also
Formatting date to string
How to do it...
How it works...
See also
Parsing the string into date
How to do it...
How it works...
Converting dates to epoch and vice versa
How to do it...
How it works...
Retrieving time units from the date
How to do it...
How it works...
Date arithmetics
How to do it...
How it works...
Finding the difference between two dates
How to do it...
How it works...
Converting between time zones
How to do it...
How it works...
Running the code block periodically
How to do it...
How it works...
Waiting a certain amount of time
How to do it...
How it works...
Timeout long-running operations
How to do it...
How it works...
There's more...
Serializing the time and date
How to do it...
How it works...
In and Out
Introduction
Reading standard input
How to do it...
How it works...
Writing standard output and error
How to do it...
How it works...
Opening a file by name
How to do it...
How it works...
Reading the file into a string
How to do it...
How it works...
Reading/writing a different charset
How to do it...
How it works...
See also
Seeking a position within a file
How to do it...
How it works...
Reading and writing binary data
How to do it...
How it works...
Writing to multiple writers at once
How to do it...
How it works...
Piping between writer and reader
How to do it...
How it works...
Serializing objects to binary format
How to do it...
How it works...
Reading and writing ZIP files
How to do it...
How it works...
Parsing a large XML file effectively
How to do it...
How it works...
Extracting data from an incomplete JSON array
How to do it...
How it works...
Discovering the Filesystem
Introduction
Getting file information
How to do it...
How it works...
Creating temporary files
How to do it...
How it works...
Writing the file
How to do it...
How it works...
Writing the file from multiple goroutines
How to do it...
How it works...
Listing a directory
How to do it...
How it works...
Changing file permissions
How to do it...
How it works...
Creating files and directories
How to do it...
How it works...
Filtering file listings
How to do it...
How it works...
See also
Comparing two files
How to do it...
How it works...
Resolving the user home directory
How to do it...
How it works...
Connecting the Network
Introduction
Resolving local IP addresses
How to do it...
How it works...
Connecting to the remote server
How to do it...
How it works...
Resolving the domain by IP address and vice versa
How to do it...
How it works...
Connecting to the HTTP server
How to do it...
How it works...
See also
Parsing and building a URL
How to do it...
How it works...
Creating an HTTP request
How to do it...
How it works...
Reading and writing HTTP headers
How to do it...
How it works...
Handling HTTP redirects
How to do it...
How it works...
Consuming the RESTful API
How to do it...
How it works...
Sending a simple email
Getting ready
How to do it...
How it works...
Calling the JSON-RPC service
How to do it...
How it works...
Working with Databases
Introduction
Connecting the database
Getting ready
How to do it...
How it works...
Validating the connection
Getting ready
How to do it...
How it works...
Executing statements
Getting ready
How to do it...
How it works...
Operations with prepared statements
Getting ready
How to do it...
How it works...
Canceling the pending query
Getting ready
How to do it...
How it works...
Reading query result metadata
Getting ready
How to do it...
How it works...
Retrieving data from a query result
Getting ready
How to do it...
How it works...
Parsing the query result into a map
Getting ready
How to do it...
How it works...
Handling transactions
Getting ready
How to do it...
How it works...
Executing stored procedures and functions
Getting ready
How to do it...
How it works...
Come to the Server Side
Introduction
Creating the TCP server
How to do it...
How it works...
Creating the UDP server
How to do it...
How it works...
Handling multiple clients
How to do it...
How it works...
Creating the HTTP Server
How to do it...
How it works...
Handling HTTP requests
How to do it...
How it works...
Creating HTTP middleware layer
How to do it...
How it works...
Serving static files
How to do it...
How it works...
Serving content generated with templates
How to do it...
How it works...
Handling redirects
How to do it...
How it works...
Handling cookies
How to do it...
How it works...
Gracefully shutdown the HTTP server
How to do it...
How it works...
Serving secured HTTP content
Getting ready
How to do it...
How it works...
Resolving form variables
How to do it...
How it works...
Fun with Concurrency
Introduction
Synchronizing access to a resource with Mutex
How to do it...
How it works...
Creating map for concurrent access
How to do it...
How it works...
Running a code block only once
How to do it...
How it works...
Pooling resources across multiple goroutines
How to do it...
How it works...
Synchronizing goroutines with WaitGroup
How to do it...
How it works...
Getting the fastest result from multiple sources
How to do it...
How it works...
Propagating errors with errgroup
How to do it...
How it works...
Tips and Tricks
Introduction
Logging customization
How to do it...
How it works...
Testing the code
How to do it...
How it works...
See also
Benchmarking the code
How to do it...
How it works...
See also
Creating subtests
How to do it...
How it works...
See also
Testing the HTTP handler
How to do it...
How it works...
Accessing tags via reflection
How to do it...
How it works...
Sorting slices
How to do it...
How it works...
Breaking HTTP handlers into groups
How to do it...
How it works...
Utilizing HTTP/2 server push
Getting ready
How to do it...
How it works...
Other Books You May Enjoy
Leave a review - let other readers know what you think
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜