Standard Library #

Strings
A complete guide to the strings package in Go — searching and checking substrings, text transformations, splitting and joining strings, content replacement, and efficient usage patterns in production applications.
IO
A complete guide to I/O in Go — the io.Reader and io.Writer interfaces, reading and writing files with os and bufio, working with pipes and buffers, reader/writer composition, and efficient stream handling patterns in production applications.
Math
A complete guide to the math package in Go — mathematical constants, rounding functions, trigonometry, logarithms and exponents, extreme values, math/rand for random numbers, math/big for arbitrary precision, and safe numeric usage patterns in production applications.
Fmt
A complete guide to the fmt package in Go — formatting strings with verbs, Sprintf and Fprintf, printing to stdout and stderr, Scanf for input, error formatting with %w, and fmt usage patterns in production applications.
Os
A complete guide to the os package in Go — file and directory operations, environment variables, program arguments, OS signals, error handling with os.IsNotExist, and usage patterns of os in production applications.
Time
A complete guide to the time package in Go — time.Time and time zones, parsing and formatting, durations and time arithmetic, Timers and Tickers for scheduling, timeouts with context, and time handling patterns in production applications.
Strconv
A complete guide to the strconv package in Go — converting strings to int and float, FormatInt and FormatFloat, ParseBool and FormatBool, handling ErrSyntax and ErrRange errors, and when strconv is better than fmt.Sprintf.
Errors
A complete guide to the errors package in Go — errors.New, fmt.Errorf with %w, errors.Is and errors.As for error inspection, layered error wrapping, custom error types, and idiomatic error handling patterns in production applications.
Encoding Json
A complete guide to the encoding/json package in Go — Marshal and Unmarshal, json struct tags, encoding to an io.Writer with Encoder, decoding from an io.Reader with Decoder, custom marshalers, handling dynamic types with interface{}, and JSON patterns in production APIs.
Net Http
A complete guide to the net/http package in Go — HTTP servers with handlers and ServeMux, HTTP clients for GET and POST requests, middleware patterns, timeouts and context, form and file upload handling, and REST API patterns in production applications.
Context
A complete guide to the context package in Go — context.Background and context.TODO, WithCancel for cancellation, WithTimeout and WithDeadline for time limits, WithValue for storing data, context propagation across goroutines and HTTP requests, and context patterns in production applications.
Sync
A complete guide to the sync package in Go — Mutex and RWMutex for mutual exclusion, WaitGroup for waiting on goroutines, Once for one-time initialization, Pool for object pooling, Map for concurrent maps, and safe synchronization patterns in production applications.
Log Slog
A complete guide to the log/slog package in Go — structured logging with levels, built-in handlers (TextHandler and JSONHandler), custom Handlers, loggers with context, attributes and groups, context integration, and logging patterns in production applications.
Sort
A complete guide to the sort package in Go — sort.Slice and sort.SliceStable, sort.Sort with the interface, binary search with sort.Search, sorting primitive types, custom comparators, and sorting complex data patterns in production applications.
Bytes
A complete guide to the bytes package in Go — byte slice manipulation, bytes.Buffer for building data incrementally, searching and replacing in byte slices, comparison and transformation, integration with io.Reader and io.Writer, and bytes usage patterns in binary and text data processing.
Bufio
A complete guide to the bufio package in Go — bufio.Scanner for reading line by line, bufio.Reader for buffered reads with lookahead, bufio.Writer for efficient buffered writes, custom split functions, and bufio usage patterns for text parsing and high-performance I/O.
Filepath
A complete guide to the path/filepath package in Go — Join and Split for path manipulation, Abs and Rel for absolute and relative paths, Glob for wildcard file search, WalkDir for recursive traversal, Ext and Base for path components, and filepath usage patterns in cross-platform applications.
Regexp
A complete guide to the regexp package in Go — compiling regexes with MustCompile, searching and matching with FindString and MatchString, extracting capture groups, replacing with ReplaceAll, splitting with regexp, Go regex flags and syntax, and regexp usage patterns in validation and text parsing.
Encoding Csv
A complete guide to the encoding/csv package in Go — reading CSV with Reader, writing CSV with Writer, delimiter and quoting configuration, handling headers, fields containing commas and newlines, lazy quotes, and encoding/csv usage patterns for data processing in production applications.
Crypto
A complete guide to the crypto packages in Go — hashing with crypto/sha256 and crypto/md5, secure randomness with crypto/rand, HMAC for integrity verification, bcrypt for password hashing, constant-time comparison, and cryptographic security patterns in production applications.
Testing
A complete guide to the testing package in Go — unit tests with TestXxx, table-driven tests, subtests with t.Run, benchmarks with BenchmarkXxx, fuzzing with FuzzXxx, test helpers, coverage, testing with mocks and interfaces, and idiomatic testing patterns in production applications.
Flag
A complete guide to the flag package in Go — defining CLI flags, parsing arguments, built-in flag types, custom flag types, subcommands with FlagSet, integration with environment variables, and patterns for building ergonomic CLI tools in production applications.
Sync Atomic
A complete guide to the sync/atomic package in Go — atomic operations for integers and pointers, atomic.Value for safely storing any value, atomic.Bool and generic types (Go 1.19+), comparison with Mutex, memory ordering, and atomic usage patterns in high-performance counters, flags, and caches.
About | Author | Content Scope | Editorial Policy | Privacy Policy | Disclaimer | Contact