Xo is experimental. The source is now public on GitHub, or try Xo in your browser.
Menu · Std reference

Docs

Standard library reference

One page per std module, generated from the doc comments and signatures with xo doc std/NAME (run it in a terminal for the same text). Import a module with use std/NAME. The prelude’s methods on Str, List, Map and the other builtin types are in the standard library specification; what each module follows in Go’s standard library is in the coverage table.

ModuleWhat it is
std/adler32Go’s hash/adler32: the checksum of zlib (RFC 1950).
std/amqpstd/amqp: AMQP 1.0 (ISO/IEC 19464, OASIS), a port of github.com/Azure/go-amqp v1.7.0 (MIT, Copyri…
std/amqptestServe it on a listener (the test world’s in memory listeners work) and dial it with std/amqp.
std/archivegzip compression and tar and zip archives, in memory and pure: read and write the bytes with Fs.
std/backoffExponential backoff with jitter and a retry loop, cenkalti/backoff v4’s ExponentialBackOff and Re…
std/base32Go’s encoding/base32: the alphabets of RFC 4648.
std/base64Go’s encoding/base64: the four alphabets of RFC 4648.
std/bcryptgolang.org/x/crypto/bcrypt: password hashes in the bcrypt format ($2a$ with a cost, a 22 characte…
std/bigGo’s math/big Int as an immutable value: every operation returns a new BigInt, with Go’s results …
std/binaryGo’s encoding/binary byte orders and varints as pure functions on Bytes.
std/bufioA buffered reader over any Stream (a Conn, a ServerConn, a TLS connection), after Go’s bufio.Re…
std/cborRFC 8949 CBOR over a Value tree that holds the whole data model: encode with the preferred serial…
std/charsetText encodings other than UTF-8: UTF-16 (Excel’s “Unicode Text” is UTF-16LE with a byte order mar…
std/cliCommand line parsing for tools: a command is a value built by functions (flags, positional argume…
std/compressGo’s compress/gzip, compress/flate, and compress/zlib over whole buffers: the bytes Go’s writers …
std/cookiejarA cookie jar with net/http/cookiejar’s rules (RFC 6265 section 5): the cookies a server sets for …
std/crc32Go’s hash/crc32: the 32 bit cyclic redundancy check of gzip, zip and PNG (IEEE) and of iSCSI, ext…
std/crc64Go’s hash/crc64: the 64 bit cyclic redundancy check (ISO 3309, used by Redis and HDLC; ECMA 182, …
std/cronA crontab schedule and its next fire time, a port of robfig/cron v3’s standard parser (parser.go)…
std/cryptoHashing and comparison are pure; anything random takes the Rand capability (std.md 3.4), so tes…
std/csvComma separated values as RFC 4180 writes them: quoted fields with "" for a quote, line breaks …
std/debugA router a server mounts to profile and inspect itself while it runs: CPU and heap profiles, the …
std/dequeA double ended queue on a ring buffer: O(1) at both ends (amortized: it doubles when full), as a …
std/dnsGo’s DNS record lookups (net.LookupMX, LookupTXT, LookupSRV, LookupAddr) over a Net: `uses net.di…
std/embedA Dir is the files a constant embeds at build time: const SITE: embed.Dir = embed("static").
std/fnvGo’s hash/fnv: the Fowler-Noll-Vo hashes FNV-1 and FNV-1a, 32, 64 and 128 bits.
std/goBindings written by xo bind (internal/gobind) import this module for go.Error; user code need…
std/grpcstd/grpc (decision 0535): gRPC over std/http’s HTTP/2.
std/heapA binary heap ordered by a comparison the caller gives, after Go’s container/heap (heap.go: Init,…
std/htmlGo’s html package: the five HTML special characters escaped, and entities (named, including the l…
std/htmlentA declaration file so the Go backend compiles the lookups from std/native/htmlent.xo.
std/htmltokgolang.org/x/net/html’s Tokenizer (token.go, BSD license, Copyright 2010 The Go Authors): the HTM…
std/httpsee spec/std.md 4
std/idnaInternationalised domain names as in golang.org/x/net/idna: UTS 46 mapping and validation, RFC 34…
std/jpegGo’s image/jpeg Decode and DecodeConfig over whole buffers: baseline and progressive JPEG, every …
std/jsonWhich types implement Json is builtin to the checker (std.md 5 table): scalars, Str, Bytes, Dur…
std/jwtJSON Web Tokens in the JWS compact form (RFC 7515, RFC 7519) on std/crypto, with golang-jwt/jwt v…
std/logLogging performs the log effect (core 6.1, decision 0156); configure performs stdio.
std/mailGo’s net/mail addresses (RFC 5322 with RFC 2047 encoded words).
std/metricsCounters, gauges and histograms with label values, and their Prometheus text exposition (format v…
std/mimeGo’s mime: media types (RFC 2045, 2231), the extension table (Go’s builtin one only, the same on …
std/multipartGo’s mime/multipart in memory: the body is a request’s, already capped by the server.
std/netipGo’s net/netip: IP addresses and prefixes as values.
std/normUnicode normalization of golang.org/x/text/unicode/norm: the four forms of UAX #15 (NFC, NFD, NFK…
std/otlpsee decision 0539): OTLP export of std/trace spans and std/metrics registries, as the opentelemetry-proto 1.x messages (ExportTraceServiceRequest, ExportMetricsServiceRequest) written straight onto std/protobuf’s builder, the body of OTLP/HTTP’s POST /v1/traces and /v1/metrics (Content-Type application/x-protobuf
std/otpOne time passwords: HOTP (RFC 4226), TOTP (RFC 6238) and the otpauth:// URI an authenticator app …
std/pathPure helpers for / separated paths, the form every Fs capability uses on every OS (std.md 3.1).
std/pngGo’s image/png, Decode, DecodeConfig and Encode, over whole buffers: the image Go decodes to for …
std/protobufstd/protobuf (decision 0530): the Protocol Buffers wire format, as Go’s google.golang.org/protobu…
std/protodescThe descriptors of google/protobuf/ descriptor.proto that reflection, ProtoJSON and Any resolve n…
std/protojsonProtocol Buffers’ canonical JSON mapping as protobuf-go’s encoding/protojson: a message is conver…
std/protoparsestd/protoparse (decision 0530): a parser for .proto files (proto3), for xo proto gen.
std/protowktThe well known types of protobuf’s google/protobuf/*.proto as Xo values with their wire codecs wr…
std/rateA token bucket rate limiter, golang.org/x/time/rate’s Limiter: limit tokens a second fill a bucke…
std/regexpRegular expressions with RE2 syntax and guarantees (Go’s regexp): matching takes time linear in t…
std/smtpGo’s net/smtp SendMail as one call: STARTTLS through std/tls, PLAIN and CRAM-MD5, Go’s checks and…
std/sqlsee spec/std.md 10
std/sqliteA SQLite driver for std/sql’s open_driver, over the SQLite library (public domain) linked into th…
std/tabwriterGo’s text/tabwriter: elastic tabstops, columns of text terminated by tabs aligned over runs of co…
std/taskSemaphore, Once, and Group are opaque handles: copies share the same permits, result, or group.
std/templateGo’s text/template over a json.Value: the same actions, pipelines, built in functions, output, an…
std/termColors for terminal output that follow the user’s settings: NO_COLOR, FORCE_COLOR, TERM=dumb, and…
std/testingsee spec/std.md 8, core 9.2
std/timeInstants, durations, and RFC 3339 in UTC are in the prelude (std.md 2.6); this module adds zones,…
std/timegoPure.
std/tlsA TLS client on a connection the program dialed itself (the STARTTLS shape: Postgres’s SSLRequest…
std/tomlTOML 1.0 configuration files decoded into the same types as JSON (derive Json, std.md 5): a tab…
std/traceRequest ids and a bounded ring of spans (what took how long inside a request), with no exporter: …
std/udpGo’s net.ListenPacket and net.DialUDP: UDP datagrams over a Net.
std/urlGo’s net/url query and path escaping and url.Values.
std/uuidRFC 9562 UUIDs, following github.com/google/uuid: random (v4) and time ordered (v7) ones from the…
std/websocketWebSockets (RFC 6455) with gorilla/websocket’s behavior: a handler upgrades its request, a client…
std/x509Go’s crypto/x509: parsing X.509 certificates (RFC 5280) and verifying chains, as std/tls does for…
std/xmlGo’s encoding/xml: the Decoder’s tokens (namespaces resolved, entities and CDATA decoded, Go’s er…
std/xmlcodecThe helpers the code derive Xml generates calls: it builds a struct’s element tree from pieces …
std/yamlYAML decoded into and encoded from structs that derive Yaml, by the types of their fields, with g…