Log In
Or create an account -> 
Imperial Library
  • Home
  • About
  • News
  • Upload
  • Forum
  • Help
  • Login/SignUp

Index
Title Page Copyright and Credits
Mastering Go
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 Download the color images Conventions used
Get in touch
Reviews
Go and the Operating System
The structure of the book The history of Go Why learn Go? Go advantages
Is Go perfect?
What is a preprocessor?
The godoc utility
Compiling Go code Executing Go code Two Go rules
You either use a Go package or do not include it There is only one way to format curly braces
Downloading Go packages Unix stdin, stdout, and stderr About printing output Using standard output Getting user input About := and =
Reading from standard input Working with command-line arguments
About error output Writing to log files
Logging levels Logging facilities Log servers A Go program that sends information to log files About log.Fatal() About log.Panic()
Error handling in Go
The error data type Error handling
Additional resources Exercises Summary
Understanding Go Internals
The Go compiler Garbage Collection
The Tricolor algorithm More about the operation of the Go Garbage Collector Unsafe code About the unsafe package Another example of the unsafe package
Calling C code from Go
Calling C code from Go using the same file Calling C code from Go using separate files The C code The Go code Mixing Go and C code
Calling Go functions from C code
The Go package The C code
The defer keyword Panic and Recover
Using the panic function on its own
Two handy Unix utilities
The strace tool The dtrace tool
Your Go environment The Go Assembler Node Trees Learning more about go build General Go coding advices Additional Resources Exercises Summary
Working with Basic Go Data Types
Go loops
The for loop The while loop The range keyword Examples of Go for loops
Go arrays
Multi-dimensional arrays The shortcomings of Go arrays
Go slices
Performing basic operations on slices Slices are being expanded automatically Byte slices The copy() function Multidimensional slices Another example of slices Sorting slices using sort.slice()
Go maps
Storing to a nil map When you should use a map?
Go constants
The constant generator iota
Go pointers Dealing with times and dates
Working with times Parsing times Working with dates Parsing dates Changing date and time formats
Additional resources Exercises Summary
The Uses of Composite Types
About composite types Structures
Pointers to structures Using the new keyword
Tuples Regular expressions and pattern matching
Now for some theory A simple example A more advanced example Matching IPv4 addresses
Strings
What is a rune? The Unicode package The strings package
The switch statement Calculating Pi with great accuracy Developing a key/value store in Go Additional resources Exercises Summary
Enhancing Go Code with Data Structures
About graphs and nodes Algorithm complexity Binary trees in Go
Implementing a binary tree in Go Advantages of binary trees
Hash tables in Go
Implementing a hash table in Go Implementing the lookup functionality Advantages of hash tables
Linked lists in Go
Implementing a linked list in Go Advantages of linked lists
Doubly linked lists in Go
Implementing a doubly linked list in Go Advantages of doubly linked lists
Queues in Go
Implementing a queue in Go
Stacks in Go
Implementing a stack in Go
The container package
Using container/heap Using container/list Using container/ring
Generating random numbers
Generating random strings
Additional Resources Exercises Summary
What You Might Not Know About Go Packages
About Go packages About Go functions
Anonymous functions Functions that return multiple values The return values of a function can be named! Functions with pointer parameters Functions that return pointers Functions that return other functions Functions that accept other functions as parameters
Developing your own Go packages
Compiling a Go package Private variables and functions The init() function
Reading the Go code of a standard Go package
Exploring the code of the net/url package Looking at the Go code of the log/syslog package
Creating good Go packages The syscall package
Finding out how fmt.Println() really works
Text and HTML templates
Generating text output Constructing HTML output Basic SQLite3 commands
Additional resources Exercises Summary
Reflection and Interfaces for All Seasons
Type methods Go interfaces About type assertion Developing your own interfaces
Using a Go interface Using switch with interface and data types
Reflection
A simple Reflection example A more advanced reflection example The three disadvantages of reflection
Object-oriented programming in Go! Additional resources Exercises Summary
Telling a Unix System What to Do
About Unix processes The flag package The io.Reader and io.Writer interfaces
Buffered and unbuffered file input and output
The bufio package Reading text files
Reading a text file line by line Reading a text file word by word Reading a text file character by character Reading from /dev/random
Reading the amount of data you want from a file Why are we using binary format? Reading CSV files Writing to a file Loading and saving data on disk The strings package revisited About the bytes package File permissions Handling Unix signals
Handling two signals Handling all signals
Programming Unix pipes in Go
Implementing the cat(1) utility in Go
Traversing directory trees Using eBPF from Go About syscall.PtraceRegs Tracing system calls User ID and group ID Additional resources Exercises Summary
Go Concurrency – Goroutines, Channels, and Pipelines
About processes, threads, and goroutines
The Go scheduler Concurrency and parallelism
Goroutines
Creating a goroutine Creating multiple goroutines
Waiting for your goroutines to finish
What if the number of Add() and Done() calls do not agree?
Channels
Writing to a channel Reading from a channel Channels as function parameters
Pipelines Additional resources Exercises Summary
Go Concurrency – Advanced Topics
The Go scheduler revisited
The GOMAXPROCS environment variable
The select keyword Timing out a goroutine
Timing out a goroutine – take 1 Timing out a goroutine – take 2
Go channels revisited
Signal channels Buffered channels Nil channels Channel of channels Specifying the order of execution for your goroutines
Shared memory and shared variables
The sync.Mutex type
What happens if you forget to unlock a mutex?
The sync.RWMutex type Sharing memory using goroutines
Catching race conditions The context package
An advanced example of the context package Worker pools
Additional resources Exercises Summary
Code Testing, Optimization, and Profiling
The Go version used in this chapter
Comparing Go version 1.10 with Go version 1.9
Installing a beta or RC version of Go About optimization Optimizing Go code Profiling Go code
The net/http/pprof standard Go package A simple profiling example A convenient external package for profiling The web interface of the Go profiler
A profiling example that uses the web interface A quick introduction to Graphviz
The go tool trace utility Testing Go code
Writing tests for existing Go code
Benchmarking Go code A simple benchmarking example
A wrong benchmark function
Benchmarking buffered writing Finding unreachable Go code Cross-compilation Creating example functions Generating documentation Additional resources Exercises Summary
The Foundations of Network Programming in Go
About net/http, net, and http.RoundTripper
The http.Response type The http.Request type The http.Transport type
About TCP/IP About IPv4 and IPv6 The nc(1) command-line utility Reading the configuration of network interfaces Performing DNS lookups
Getting the NS records of a domain Getting the MX records of a domain
Creating a web server in Go
Profiling an HTTP server Creating a website in Go
HTTP tracing
Testing HTTP handlers
Creating a web client in Go
Making your Go web client more advanced
Timing out HTTP connections
More information about SetDeadline Setting the timeout period on the server side Yet another way to time out!
Wireshark and tshark tools Additional resources Exercises Summary
Network Programming – Building Servers and Clients
The net standard Go package A TCP client
A slightly different version of the TCP client
A TCP server
A slightly different version of the TCP server
A UDP client Developing a UDP server A concurrent TCP server
A handy concurrent TCP server
Remote Procedure Call (RPC)
The RPC client The RPC server
Doing low-level network programming
Grabbing raw ICMP network data
Where to go next? Additional resources Exercises Summary
Other Books You May Enjoy
Leave a review - let other readers know what you think
  • ← Prev
  • Back
  • Next →
  • ← Prev
  • Back
  • Next →

Chief Librarian: Las Zenow <zenow@riseup.net>
Fork the source code from gitlab
.

This is a mirror of the Tor onion service:
http://kx5thpx2olielkihfyo4jgjqfb7zx7wxr3sd4xzt26ochei4m6f7tayd.onion