What you will learn in Go in Practice, Second Edition
Chapter by chapter
Concepts explained in this book
- GoGo is a statically typed, compiled, open-source programming language designed for systems programming and large-scale software development.
- goroutineA goroutine is a lightweight Go-managed execution context that runs a function concurrently with other program activity.
- routingURL pattern matching is the routing of requests by applying expressive patterns to URL paths rather than only comparing fixed path segments.
- reflectionThe Go reflect package provides runtime facilities for inspecting and manipulating the types and values of program data.
- structA struct is a composite Go type that groups named or anonymous fields into a single value.
- failureAn error is a condition indicating that an operation failed or produced a result outside expected behavior while the program may still be able to continue.
- panicA panic is a Go runtime failure mechanism indicating that execution cannot safely continue and causing stack unwinding to locate a handler or terminate the program.
- code generationCode generation is the automated production of program source or implementation code from declarations, schemas, or other inputs.
- text/template packageThe Go text/template package generates text from templates containing data substitutions and control logic without HTML-specific contextual escaping.
- channelA Go channel is a typed communication mechanism that transfers values between goroutines and synchronizes their execution.
- deserializationUnmarshaling is the process of converting a serialized representation into in-memory data structures.
- html/template packageThe Go html/template package generates HTML safely from templates containing data substitutions and control logic.
- go commandThe go tool is Go's command-line tool for compiling and performing other standard development tasks.
- path variableA path variable is a named value captured from a matched URL path and made available to the request handler.
- genericsA generic function is a function declared with type parameters so it can operate across multiple permitted concrete types.
- deferA deferred function is a function call scheduled by Go to execute when its surrounding function returns, including during panic unwinding.
- streamingAn event stream is an ordered flow of discrete event records delivered continuously over time.
- standard libraryA standard library is a collection of reusable modules, types, functions, APIs, and other facilities distributed with a programming language implementation or platform.
- closureA closure is a function value that retains access to variables from its enclosing lexical scope.
- recoverrecover is a Go built-in function that retrieves the value associated with a panicking execution and stops the panic from continuing when called from a deferred function.
- go keywordThe Go keyword is a language construct that starts a function call as a goroutine while allowing the caller to continue immediately.
- struct tagA struct tag is a Go field annotation containing metadata, commonly expressed as whitespace-separated key-value pairs for controlling data encoding or other processing.
- template.HTMLtemplate.HTML is a Go html/template type representing trusted HTML content that is intended to bypass normal contextual escaping.
- ParseMultipartFormParseMultipartForm is a Go HTTP request method that parses multipart form data and makes its parts available through the request's form fields and file APIs.
- wildcardA wildcard is a route-pattern element that matches a variable portion of a URL path.
- exceptionError handling is the practice of detecting, interpreting, propagating, recovering from, or otherwise responding to program errors.
- bufferingBuffered I/O accumulates input or output in memory buffers so data can be processed or transferred in larger units.
- gofmtgo fmt is a Go command that reformats Go source files according to the language's canonical formatting style.
- goimportsgoimports is a Go formatting tool that formats source code and adds or removes package imports based on usage.
- reflect.Kindreflect.Kind is a Go reflection enumeration identifying the broad underlying category of a value's type.
- command-line argumentA command-line argument is a positional value supplied to a command-line program when it is invoked.
- monitoringLogging is the recording of program events and diagnostic information for later inspection.
- methodA method is a function associated with a type and receiving a value of that type as its receiver.
- reflect.Valuereflect.Value is a Go reflection value that represents the runtime value of a program object and exposes operations for inspecting it.
- reflect.Typereflect.Type is a Go reflection interface that represents a type and provides operations for querying its properties and relationships.
- multipart requestA multipart message is a message divided into separately typed parts, each with its own headers and content.
- dependency managementDependency management is the process of declaring, resolving, obtaining, and maintaining software components required by an application.
- empty interfaceany is a predeclared Go type alias for the empty interface type interface{}, allowing values of any type.
- templateAn HTML template is a document template containing markup, data substitutions, and control logic for generating output.
- net/http packagenet/http is Go's standard library package for HTTP clients and servers.
- backpressureBack pressure is the buildup of pending data when a producer sends faster than a downstream consumer or network can process it.
- go testgo test is a Go command that compiles and runs tests for Go packages.
- multiple return valuesMultiple return values are function results in which a single invocation provides more than one distinct value.
- template inheritanceTemplate inheritance is a composition pattern in which an extending template fills or overrides sections defined by a shared base template.
- configurationConfiguration is information that specifies how a program or system should operate.
- go.mod fileA go.mod file declares a Go module's module path, target Go version, and required dependencies.
- go mod initgo mod init is a Go command that creates a new module definition with a specified module path.
- go generatego generate is a Go command that executes source-code generation directives embedded in Go files.
- base templateA base template is a template containing shared markup and references to sections supplied or overridden by extending templates.
- block directiveA block directive defines a template section with default content and immediately executes that section when invoked.
- ExecuteTemplateExecuteTemplate is a Go template execution method that renders a named template with supplied data.
- nested templateA nested template is a template that includes or invokes another template as part of rendering output.
- serverA web server is software that listens for network requests and returns responses over web protocols such as HTTP.
- Go runtimeThe Go runtime is the system software bundled with Go programs that provides execution support such as scheduling, memory management, and garbage collection.
- flag packageThe Go flag package parses command-line flags and provides APIs for defining flags and generating their help text.
- file uploadA file upload is the transfer of a local file from a client to a server through a form or other network request.
- static fileA static file is a preexisting file served to clients without being generated dynamically for each request.
- code coverageCode coverage is a measurement of which portions of program code are executed by a test suite.
- execution context stackA call stack is the runtime structure that records active function invocations and their execution contexts.
- panic recovery patternA panic recovery pattern is a control-flow pattern that catches a panic, preserves or reports its information, and allows surrounding application execution to continue.
- go getgo get is a Go command that adds or retrieves package dependencies for a module.
- queueA queue is a data structure that removes elements in the order they were inserted.
- type-safe collectionA type-safe collection is a collection whose operations preserve the declared element type without requiring unchecked runtime type conversions.
- garbage collectionA garbage collection system automatically identifies and reclaims memory that a program can no longer access.
- template actionA Go action is a command or data expression enclosed in double curly brackets within a Go template.
- codecgencodecgen is a code-generation command that creates serialization methods for types handled by the go/codec library.
- connection reuseConnection reuse is the practice of sending multiple network requests over an already established connection.
- http.Transporthttp.Transport is the Go net/http component that manages the low-level details of HTTP requests, including connection reuse.
- keep-aliveHTTP keep-alive is an HTTP feature that allows a server to retain a connection for subsequent requests.
- race-condition detectionRace-condition detection is dynamic analysis of concurrent program execution that identifies conflicting unsynchronized accesses to shared data.
- type constraintA type constraint is a generic declaration that restricts a type parameter to a specified set of types.
- gRPCgRPC is a high-performance remote procedure call framework and protocol for defining services and invoking them across networks.
- go moduleA Go module is a versioned collection of Go packages described by a go.mod file and its dependency requirements.
- packageA Go package is a compilable unit of related Go source files whose exported identifiers are referenced through the package name.
- runeA rune is Go's integer type for representing a Unicode code point.
- testing packageThe Go testing package is a standard-library package for defining and running automated tests and reporting test failures.
- end-of-file indicatorEnd-of-file is the condition indicating that no more data can be read from a file or stream.
- MIME typeA MIME type is a media-type identifier that describes the format of a file or other data, such as image/png or application/octet-stream.
- os packageThe Go os package provides portable functions for interacting with operating-system facilities such as environment variables, files, and processes.
- concurrencyConcurrent execution is the progression of multiple computations during overlapping time intervals.
- dependencyA dependency is a software package or module required by another package or module.
- JSON Web TokenA JSON Web Token is a signed token format for transmitting claims between parties, commonly including identity information.
- HTTP methodAn HTTP method is a standardized operation token in an HTTP request that specifies the intended action on a resource.
- command-line toolA console application is a program operated through a command-line text console by supplying commands, options, and arguments.
- WebSocketWebSocket is a protocol that provides persistent, bidirectional communication between a client and server over a single connection.
- recoveryPanic recovery is the technique of regaining control after a Go panic by executing deferred recovery logic during stack unwinding.
- serializationSerialization is the conversion of in-memory data into a representation suitable for storage or transmission.
- attributeAn annotation is metadata associated with program declarations or data structures to provide additional information for tools or runtime processing.
- duck typingDuck typing is a typing approach that determines an object's suitability by the methods and behaviors it provides rather than by explicit nominal declarations.
- functional, stateless philosophyFunctional programming is a programming paradigm that emphasizes function composition, expressions, and controlled handling of state and side effects.
- multiparadigm languageA multiparadigm language supports programming techniques from multiple programming paradigms rather than prescribing one paradigm.
- object-oriented programmingObject-oriented programming is a programming paradigm that organizes software around objects combining data with operations and commonly uses abstraction, inheritance, and polymorphism.
- pipelineA template pipeline is a Go template construct that sequences commands and supports value processing and control logic.
- multipart.FileHeadermultipart.FileHeader is a Go structure containing metadata about an uploaded multipart file and providing access to its contents.
- protocol bufferProtocol Buffers is a language- and platform-neutral schema system and compact binary serialization format for structured data, with support for generated code.
- protocprotoc is the Protocol Buffer compiler that parses .proto definitions and generates source code for supported languages.
- github.com/go-ini/inigithub.com/go-ini/ini is a Go package for parsing, accessing, and writing INI configuration files and strings.
- github.com/kylelemons/go-gypsy/yamlgithub.com/kylelemons/go-gypsy/yaml is a Go package for reading, accessing, converting, and writing YAML data.
- INIINI is a simple text configuration-file format organized into named sections containing key-value settings.
- YAMLYAML is a human-readable data serialization format commonly used for structured configuration and data exchange.
- testA test case is a defined set of inputs, conditions, and expected results for verifying software behavior.
- microservice architectureA microservice architecture is an application architecture composed of independently deployable services that communicate over a network.
- reflect.Indirectreflect.Indirect is a Go reflect function that returns the value referenced by a pointer or returns its argument unchanged when it is not a pointer.
- reflect.StructFieldreflect.StructField is a Go reflection descriptor containing metadata about a field declared in a struct type.
- Type.FieldType.Field is a Go reflect method that returns metadata describing a struct field at a specified index.
- Type.NumFieldType.NumField is a Go reflect method that returns the number of fields declared in a struct type.
- Value.FieldValue.Field is a Go reflect method that returns the reflection value of a struct field at a specified index.
- contextA Go context is a request- or operation-scoped value that carries deadlines, cancellation signals, and associated key-value data across function calls.
- HTTP response codeAn HTTP status code is a three-digit code in an HTTP response indicating the outcome of processing a request.
- type switchA type switch statement is a Go control-flow construct that selects a case according to the dynamic type of an interface value.
- FormFileFormFile is a Go HTTP request method that returns an uploaded file, its metadata header, and an error if retrieval fails.
- MapA map is an associative data structure that stores key-value pairs and supports retrieving values by key.
- type assertionA type assertion is a Go operation that retrieves the concrete value of an interface value when it has a specified dynamic type.
- UDPUDP is a connectionless transport-layer protocol that sends datagrams without guaranteeing delivery or ordering.
- named return valueNamed return values are function results declared with identifiers that can be referenced and assigned within the function body.
- containerA container is an isolated execution unit that packages an application and its required binaries and libraries while sharing a host operating system kernel.
- MultipartReaderMultipartReader is a Go HTTP request method that returns a reader for incrementally consuming the parts of a multipart request body.
- usable result on errorA usable result on error is a return-value pattern in which a function provides a meaningful non-error result alongside an error when failure occurs.
- CobraCobra is a Go library for building command-line applications with commands, subcommands, flags, help, and shell completion.
- command-line frameworkA command-line framework is a software framework that structures console applications and provides features such as command routing, help, subcommands, and completion.
- positional parameterA positional argument is a command-line value interpreted according to its position rather than an option name.
- subcommandA subcommand is a command nested under another command that represents a more specific command-line operation.
- UNIX-style flag processingUNIX-style flag processing is command-line option parsing that follows conventions common to UNIX, Linux, and BSD tools, including short and long options.
- custom template functionA custom template function is an application-defined function registered with a template engine and callable from template actions.
- bufioThe Go bufio package provides buffered input and output wrappers and utilities for processing streams incrementally.
- bufio.ScanLinesbufio.ScanLines is a Go bufio split function that returns successive lines from a byte stream for use with a scanner.
- line-delimited recordA line-delimited record is an independently represented data item terminated or separated by a newline.
- os.Openos.Open is a Go standard-library function that opens a file and returns a file handle for subsequent operations.
- os.ReadFileos.ReadFile is a Go standard-library function that reads an entire named file into a byte slice and returns any error encountered.
- cloud-native architectureA cloud-native application is software designed to exploit programmatic cloud infrastructure for on-demand scaling, failure recovery, and composition from distributed services.
- cross-compilationCross-compilation is the process of compiling software on one operating system or hardware architecture for execution on another.
- done channel patternThe done channel pattern uses a channel to signal cancellation or completion so concurrent operations can stop and perform cleanup.
- concurrent file compressionConcurrent file compression is a technique that compresses multiple files concurrently by assigning separate compression tasks to goroutines.
- WaitGroup.WaitThe WaitGroup Wait method blocks until the wait group's tracked task count reaches zero.
- WaitGroupA wait group is a synchronization primitive that lets a program wait for a collection of concurrent tasks to finish.
- go mod tidygo mod tidy is a Go command that adds missing module requirements and removes unnecessary ones from module metadata.
- lockingLocking is a concurrency-control technique that restricts access to a shared resource or protected operation to prevent conflicting concurrent access.
- select statementA select statement is a language construct that retrieves selected data or chooses among alternative operations or cases according to the language's rules.
- os/exec packageThe Go os/exec package runs external operating-system commands and provides access to their input, output, and termination status.
- runtime detectionRuntime detection is the technique of discovering execution-environment characteristics while a program is running instead of assuming them in advance.
- cgocgo is Go's interoperability facility for calling C code and linking C and Go sources in one program.
- timeoutA timeout is a limit on how long an operation may wait before it is abandoned or reported as unsuccessful.
- fuzzingFuzz testing is software testing that exercises a program with varied, automatically generated inputs to reveal unexpected behavior.
- static typingStatic typing determines and checks program types through analysis before execution, typically during compilation.
- file serverA file server is software that serves files from a filesystem in response to client requests.
- cryptographyCryptography is the discipline of protecting information and communications through techniques such as encryption, hashing, and authentication.
- net packageThe Go net package provides portable interfaces for network I/O, including connections, listening, and address handling.
- encodingEncoding is the transformation of information into a representation defined by a scheme for storage, processing, transmission, or interpretation.
- UTF-8UTF-8 is a variable-width Unicode character encoding that represents Unicode text as sequences of bytes.
- TCPTCP is a connection-oriented transport-layer protocol that provides reliable, ordered byte streams.
- flag.Parseflag.Parse is a Go flag-package function that parses the defined command-line flags and assigns their values.
- template function mapA template function map is a mapping from names exposed in templates to Go function values.
- template.Templatetemplate.Template is the Go type representing a parsed template together with its associated definitions and execution behavior.
- channel leakA channel leak is a failure to release an unneeded Go channel, causing it to remain allocated and consume system resources.
- close functionThe Go close function marks a channel as unable to accept further sent values and enables receivers to observe that it is closed.
- goroutine leakA goroutine leak is a failure of a goroutine to terminate after it is no longer needed, causing it to consume system resources.
- safe channel closingSafe channel closing is the practice of coordinating channel closure so that no goroutine sends on the channel after it is closed and all related goroutines can terminate.
- server-sent eventsServer-sent events are a web mechanism for continuously delivering text-based event updates from a server to a client over HTTP.
- retryA retry is a repeated attempt to perform an operation after a failure, typically to recover from a transient problem.
- error typeAn error type is a data type whose values represent failure conditions and may carry information or behavior for reporting and handling those failures.
- method-based subroutingMethod-based subrouting is routing that selects request logic by HTTP method after a shared top-level path has been matched.
- graceful shutdownA graceful shutdown is an orderly termination procedure that allows active work and resources to be completed or released before a service stops.
- ListenAndServehttp.Server.ListenAndServe is a Go method that starts an HTTP server and serves requests on its configured network address.
- build tagA Go build tag is a source-file constraint that determines whether the file is included for a particular build environment.
- goxgox is a third-party Go command-line tool that builds binaries for multiple operating systems and architectures in parallel.
- path/filepathpath/filepath is Go's standard library package for manipulating filesystem paths with operating-system-specific separators and conventions.
- slicingSlicing selects or partitions a portion of an indexed sequence or multidimensional array, often along specified indices or dimensions.
- memory management modelMemory management is the allocation, use, lifetime control, and reclamation of memory occupied by program data.
- race conditionA race condition is a correctness or timing defect caused by program behavior depending on the uncontrolled ordering of concurrent operations.
- 12-factor appA 12-factor app is an application architecture methodology that defines practices for developing, deploying, and operating portable, scalable, and maintainable services.
- cloud computingCloud computing is the on-demand delivery of computing resources and services over a network, typically with usage-based provisioning and management.
- error variableAn error variable is a package-scoped variable whose value identifies a particular error condition and can be compared or returned by Go code.
- off-by-one errorAn off-by-one error is a boundary mistake in which a loop or index begins, ends, or counts one position incorrectly.
- table-driven testA test table is a collection of input and expected-result records used to exercise multiple conditions against a test target.
- kind switchA kind switch selects behavior based on the broad underlying category reported by Go reflection rather than on an exact named type.
- logging serviceA logging service is a network-accessible system that receives, aggregates, and often stores log messages from applications.
- NetcatNetcat is a command-line networking utility that reads and writes data across TCP or UDP connections and can act as a simple listener or client.
- download resumptionDownload resumption is the continuation of a partially completed file transfer from the point at which previously received data ends.
- resilienceFault tolerance is the ability of a system to continue operating or recover when components or operations fail.
- Range headerThe Range HTTP header specifies one or more byte ranges of a resource that a client wants to receive.
- timeout detectionTimeout detection is the process of identifying whether an operation failure was caused by a network timeout.
- Stringerfmt.Stringer is a Go standard-library interface implemented by types that provide a parameterless String method returning a string.
- http.FileServerhttp.FileServer is a Go net/http function that returns an HTTP handler for serving files rooted at a filesystem directory.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.
