Repository navigation
Releases
Xo v0.55.1
Xo 0.55.1 is a fix release on 0.55.0. It fixes the xo debug regressions on Windows amd64 that 0.55.0 listed as a known issue, adds xo debug on Windows arm64 and XO_TRACE on Windows and FreeBSD, and fixes build cache, LLVM backend, std/sqlite, std/http and profiling bugs. Nothing that compiled with 0.55.0 stops compiling.
Coming in 0.56
use go and the Go backend are being retired. Xo 0.56 removes use go, --hybrid and the Go binding generator; the Go backend follows in a later release. A program that calls a Go package ports it to Xo (the standard library covers what most did) or calls it as a separate process or over the network. use c stays.
Fixes
xo debugon Windows amd64 (0.55.0's known issue, task #681): frames, breakpoints andtasksname a function the devirtualization pass copied by its source name (main.worker, notmain.worker#once; task #597), and variables of a loop the compiler split for register allocation show their values again instead of<optimized out>(task #603; linux/amd64 had it too).- std/http (task #671): a program whose scope ended right after a request to its own HTTP/2 server sometimes ran 30 s longer (std/grpcreflect showed it as a stall).
- Windows: SQLite's math functions link and run on windows/amd64 and windows/arm64 (task #621); a program using
os.secretsDpapi links (task #597); a runtime helper with a frame over 4 KiB no longer segfaults (task #597);--backend=llvmon windows/arm64 links again (task #605);XO_PROF=cputakes its samples at the requested rate (task #646);xo test --since C:\xruns only the tests the change reaches (task #605). - macOS on Intel (LLVM backend): a fault in a debug build prints its report and exits 70 instead of dying with SIGSEGV (task #650);
xo dumpshows the line a blocked task waits at (task #649). - Run cache on macOS (LLVM backend): an unchanged
xo build,xo runorxo testis a cache hit again (task #649). - Build cache (tasks #573, #574, #584): three more cases where a warm build rebuilt from source ("did not replay", "built from source").
- Heap profile (task #658):
XO_PROF=heap XO_PROF_HEAP_RATE=1 xo buildof a large program no longer dies with SIGSEGV after writing its profile. xo build --raceon macOS (task #608): building again into another directory puts the ThreadSanitizer runtime beside that binary too.- Files: a sub
Fsand wasm32 refuse"a.txt/"as not a directory, as nativeos.fsdoes (tasks #597, #616, #629). - std/sqlite: an INTEGER in a
BOOLEANcolumn reads as a Boolean, as mattn/go-sqlite3. - Go backend (task #580):
1e308 * Float(12)builds and gives+Inf. xo bench --abon Linux (task #645): a side keeps theXO_STDit was given.
Added
xo debugon Windows arm64 (decision 0253, task #634).XO_TRACErecords on windows/amd64, windows/arm64, freebsd/amd64 and freebsd/arm64 (task #635).Cmd.new_group()andChild.kill_group(signal)start and signal a child's whole process group (decision 0739, task #660; not on Windows).- std/sqlite has FTS5 full text search, the percentile aggregates and the math functions on every target; the Linux archives ship its prebuilt object, so a first build no longer compiles sqlite3.c (task #622).
- Faster LLVM builds of very large functions (tasks #586, #590): a 1,500 statement function from 108 s to 4 s on an M-series Mac.
- Opt in,
XO_SEPCOMP_LLVM=1(decision 0738, task #607):--backend=llvmcompiles only the program's own code and links std from cached objects.
Known issues
--racememory grows per task spawned, as in Go's-race.- windows/arm64 has no
--race(ThreadSanitizer has no windows/aarch64 runtime). - A C sleep can end early on arm64 when the scheduler's preemption signal lands in it (the call returns EINTR; about 1 in 80 short sleeps in one test run). Since 0.53; fix planned for 0.55.2 (task #697).
CHANGELOG.md lists every change.
Xo v0.55.0
Xo 0.55.0 is the first release in which every module of the standard library is Proven: all 96 modules meet the Proven bar on features, tests and performance (std/stdcov at 28bdba13c). It adds gRPC (clients, servers, interceptors, health, reflection, retries and balancing), std/ui for local-first web apps, a MySQL driver and much more of Postgres in std/sql, a TLS server with QUIC and Encrypted Client Hello, Brotli, schema migrations, the sync effect and server fields in the language, and faster code on arm64 and x86-64. It follows 0.51.1; 0.52, 0.53 and 0.54 were internal toolchain versions and were not published, so these notes cover everything since 0.51.1.
Some changes can stop a program that compiled with 0.51.1 from compiling, or change what it does. Each is listed under "Breaking changes" with what to do.
Security
Upgrade every program built with 0.51.1 or earlier, and rebuild it, since std is compiled into the binary. Unless an item says otherwise, 0.51.1 and earlier are affected.
TLS (std/tls, std/http):
- A TLS 1.2 CBC record's MAC is computed and checked in constant time whatever its padding (Lucky13), and is checked with Arm's DIT bit set where the CPU has it (decision 0619).
- A server that requires a client certificate no longer resumes a session ticket sealed by a configuration without client authentication (GO-2026-4337).
- A TLS 1.3 server refuses a ClientHello record that carries another handshake message after the ClientHello (GO-2026-4340).
- A server's "unsupported application protocols" error quotes the client's ALPN names, so a client cannot write control bytes into a log (GO-2025-4008).
Paths and names with a NUL byte: an Fs path or symlink target holding a NUL byte is refused, so ..\0 can no longer escape a sub Fs; dial, listen and lookup_host refuse a host or port with a NUL byte, which the darwin and Windows resolvers cut short (GO-2026-4971 class).
HTTP/2 (std/http, native backends): the client checks the server's SETTINGS values as Go 1.26.11 does (GO-2026-4918); a connection returns flow control window for bodies only as handlers read them, so a client cannot make a server buffer unbounded request bodies.
Inputs that cost far more than their size (denial of service):
- std/xml and std/protobuf: decoding stops at 10,000 nesting levels, as Go's encoding/xml and protowire, where a deep document overflowed the stack.
- std/norm: a long run of combining marks normalizes in linear time (about 22 s for 1 MB of marks before).
- std/jpeg, std/png: a small file whose header asks for a huge image no longer allocates it, and a header too large for an Int is refused.
- std/url:
url.Valueswith many keys is linear; std/amqp refuses lists, maps and arrays that declare more elements than their bytes can hold.
Faults on peer input: std/csv fields are valid UTF-8 (a 7 byte file faulted csv.format), and uuid.parse of some multi-byte texts faulted while building its error.
macOS trust settings (std/x509): system_roots applies the user and admin trust settings, so a root marked Deny for SSL is left out (GO-2022-0171).
Breaking changes
Language and tools:
- The
synceffect (decision 0662): a closure that uses a capturedChan,MutexorAtomicperformssync, which a pure function type refuses (XO0701). Adduses syncto the function type. std/sql'seach,copy_from,on_noticeandon_tracecallbacks areuses synctypes, so closures that capture an Atomic or a Mutex pass again. Clocktakes its effect as a parameter (decision 0652):os.clockis aClock[clock]andtime.virtual(start)aClock[()]. Std fields that keep the OS clock nameClock[clock]; write the parameter where you name the type.xo --phase-times: a phase line endsheap_mb=N peak_mb=Ninstead of(heap N MB, peak N MB). Read the twokey=valuefields.
std/http and std/tls:
Router.handle,handle_streamandmountfault on a route that conflicts with one registered before, as Go's ServeMux panics. Remove the duplicate or make one pattern more specific.- A failed TLS handshake is
ClientErr.Tls(err: tls.TlsErr), where it was a protocol error. MatchClientErr.Tlsand readerr.kind. - A client with
Verify.Fulland an empty host fails, as Go's "either ServerName or InsecureSkipVerify must be specified". Pass the server's name ashost. - TLS alerts and errors follow Go: a TLS 1.2 server requiring a client certificate that gets none sends handshake_failure; a client whose peer closes mid-handshake reports
EOF; an IP address host is not sent as SNI; a TLS 1.3 client whose verification fails sends bad_certificate; atls.serverwithout certificates answers unrecognized_name. Code matching the old alert names updates them.
std/json, std/time, std/netip:
- A Map key in a
DecodeErrpath is written["KEY"], quoted, not.KEY(decision 0725), so a peer's key cannot forge a log line. Match on the new form. time.Dateencodes in JSON as its text,"2024-02-29", not as an object, and decoding checks the date. Stored JSON in the old form needs a one-time rewrite.netip.ParseErrkeeps Go's parts (what,input,msg,at) and builds its text indisplay();msgis now the reason alone. Usedisplay()for the full text.
std/sql (drivers written in Xo):
DriverConngainscopy_to(q, out)(decision 0679),pipeline,wait_notificationandnotices, andTraceOpgainsCopyTo. A driver adds the methods; the CHANGELOG gives a stub for each that returns an error.
std/crypto:
HashgainsBlake2b_256,Blake2b_384,Blake2b_512,Keccak256andKeccak512, andAeadgainsXChaCha20Poly1305, so an exhaustivematchwith no_ =>arm is XO0301. Add the variants or a_ =>arm.
std/ui:
- An
ui.App{...}literal now needsconfirm(confirmed Msgs,.confirming(...)). Build Apps withui.app(init, update, view).
std/migrate:
up,statusandhas_pendinggiven no migration fail withMigrateErr.NoMigrations, as goose's ErrNoMigrations. Code that ran them on an empty directory handles the error.MigrateErr.MissingisMissing(versions, newest, to)with goose's text. Update patterns and constructors.
std/protoparse and std/protodesc:
- A .proto file with no
syntaxstatement is proto2, as protoc reads it. Addsyntax = "proto3";to such a file;parsealso rejects what protoc's grammar rejects. - An option value and a field's
default_valueareBytes, as protoc keeps them ("\377"is byte 0xFF). Read them as Bytes.
std/yaml:
- Decode errors spell the target type as Xo does (
into Int,into Str,into Duration; were Go'sint,string,time.Duration). Code that matches those messages matches the Xo names.
Highlights
The standard library is Proven. Every one of the 96 std modules has Go's tests ported where they apply, race, stress, fuzz and review evidence, and a timing row against Go's package (decision 0726). The std coverage page on xolang.dev shows each module's evidence.
gRPC (std/grpc, std/grpchealth, std/grpcreflect; xo proto gen generates typed stubs from a service block): interceptors (decision 0703), service config and retries (decision 0705), keepalive, client balancing over several addresses, DNS and custom resolvers, Unix sockets, per-RPC credentials, compression, stats handlers, response metadata, health checking and server reflection, as grpc-go.
std/ui, local-first web apps (decision 0659): a server-rendered App with live updates over a socket, a browser client that predicts, sign-in and redaction (decision 0664), per-user state, rooms that step a shared state at a fixed rate (decision 0695), server fields that never reach a client (decision 0719), and stores in a directory, Postgres or an S3 style bucket, so many instances behind a load balancer act as one App (decision 0686).
Databases (std/sql): a MySQL driver written in Xo (decision 0648), prepared statements, several result sets, batches, pool stats, and cancellation on both servers; Postgres COPY in both directions, large objects, ranges, composites, arrays, numeric (sql.Numeric), named arguments and typed readers as pgx parses them (decision 0679); std/migrate runs goose's .sql migrations, layouts and dialects.
TLS and crypto: the TLS server side (Go's tls.Server), session tickets, QUIC's TLS, Encrypted Client Hello (RFC 9849), version, cipher and curve settings; Hybrid Public Key Encryption (std/hpke), SHAKE and cSHAKE, BLAKE2b, Keccak, XChaCha20-Poly1305, PBKDF2, Ed25519ph, RSA-PSS over a digest, and the crypto/subtle helpers; x509 certificate pools, revocation lists, OIDs and Go's key encodings.
Compression and encodings: Brotli encode and decode with streaming compressors (decision 0666), and Brotli response encoding in std/http; Protocol Buffers editions 2023 and 2024, prototext, protojson options, descriptors byte for byte with protoc, well known type helpers and derive Asn1 (decision 0661); CBOR tags, big integers and times; OTLP over gRPC and JSON with logs; Prometheus OpenMetrics and protobuf exposition, histograms and summaries.
Language and tools: pub open enum (decision 0649); derive Cbor tags (decision 0665); List.filled, Bytes.into_builder (decision 0722), Mutex.try_with, the rest of Go's float math and many List, Str and Bytes methods; xo test --since=REV; xo build --list-inputs; WASI reactors with xo build --lib=shared (decision 0688); new xo vet notes for costly Go idioms; xo fix --vet=CODES; and a riscv64 assembler and ELF linker (decision 0645 stage 1, no command yet).
Performance
- arm64 and x86-64: loop splitting (decision 0724) keeps a loop's hot path free of the spills a call on a rare path forced; values that would spill across calls may stay in caller-saved registers; Float constants are one load; byte loads joined into one word; constant table reads folded.
- std/crypto on x86-64: AES-G...
Xo v0.51.1
Xo 0.51.1 is a security release over 0.51.0. It fixes three ways a small, hostile compressed input could make an Xo program use far more memory or CPU than the input's size: an HTTP client reading a gzip response, a program streaming DEFLATE, gzip or zlib through compress.Decompressor, and xo mod or any program extracting a zip. It also fixes two faults a request could trigger: a Date or Civil with an extreme year, as a JSON request body can hold, stopped the program in several of its methods, and so did a long numeric character reference given to html.unescape_string. Nothing else changes.
Upgrade advice: upgrade if your programs decode a Date or Civil from input you do not control (a JSON request body, for instance), unescape HTML text from peers, make HTTP requests to servers you do not control, decode compressed data from peers, or fetch modules through a proxy you do not run.
Security
- std/compress (native backends): a
Decompressorwrite held about 16 bytes of memory for each byte it decoded, and one write returns all the output its input completes. About 62 KB of hostile gzip made one write hold 1 GB, and the defaultmax_sizeof 1 GiB allowed about 16 GiB. Output is now copied once: a write inflating 1.3 MB to 206 MB peaked at 3.34 GB, now 420 MB. One DEFLATE block fed in small writes also cost quadratic time, because the block was decoded again from its start on every write: a 4 MB block in 16 KB writes took 2706 ms, now 56 ms (a hostile 64 MB block took about 11 minutes of CPU). Input written after a zlib or raw DEFLATE stream ends is now dropped instead of kept, and aDecompressor's first error is returned by every laterwriteandfinishwithout decoding, as Go's readers keep theirs. Found by the std/compress security review (decision 0616). - std/http client (native backends): a streaming read of a gzip response gave each received chunk to the decoder in one write, so about 1 MB of hostile gzip could ask for up to 1 GiB of output at once. The body now goes to the decoder 4 KiB at a time, so one step's output stays near 4 MB: reading a 1000 MB gzip bomb of about 1 MB with
ClientStream.readtook 6.4 GB of memory and 6.1 s in 0.51.0, and takes 23 MB and 0.8 s now. - std/archive and
xo mod:unzipinflated a deflated file to its end before checking its declared size, andunzipandgunziphad no output limit. A 204 KB zip whose one file declares 100 bytes took 276 MB of memory for 200 MB of output; now 3.6 MB, with Go's error (zip: not a valid zip file).unzipandgunziptake a newmax_size(default 1 GiB;unzipchecks the declared sizes before inflating anything).xo modreads a module zip with at most 500 MB in all, and refuses anxo.modorLICENSEover 16 MB, as Go's module zip limits. - std/time: a
Date,ClockTimeorCivilmay hold any fields (a struct literal, or a JSON body decoded throughderive Json). With a year or another field far outside the calendar,Date.weekday,add_days,add_months,days_untilanddisplay, andCivil.unix,to_timeandformatfaulted on the native backends on an intermediate overflow, so a server calling one of them on a decoded value could be stopped by one request (the Go backend gave wrong answers instead). Nowweekday,display,to_timeandformatanswer for every field, and the others fault only when their answer itself does not fitInt. A server decoding aDateatInt's ends from a JSON body now answers 200 on every backend, where 0.51.0 answered 500. Found by the std/time security review (decision 0616). - std/html:
html.unescape_stringfaulted on Int overflow for a long numeric character reference (�) on the native backends, so unescaping a peer's text could stop the program or answer 500 in an HTTP handler (0.35.0 to 0.51.0; the Go backend from 0.49.0). It now reads the digits as Go's rune does, and follows Go's rule for references of three bytes or fewer:&#x;is U+FFFD and	before another byte stays text, as in Go. Found by the new std/html fuzz harness (decision 0616).
Known limits
Reading a whole response body still holds the decoded body, as Go's io.ReadAll does, up to the limit the call has. For about 1 MB of hostile gzip that inflates to 1000 MB: ClientStream.read_all (default max_size 1 GiB) peaks at about 1.1 GB, down from 1.7 GB in 0.51.0; Client.send and Client.get decode the body in one step and peak at about 2.1 GB, as in 0.51.0 (their one-shot gunzip now stops at 1 GiB of output, where it had no limit). Go does the same: http.Get then io.ReadAll of that body peaks at 2.1 GB (Go 1.26.11, linux/arm64), and reading it through resp.Body.Read with a 64 KB buffer at 14 MB, where Xo's ClientStream.read peaks at 23 MB. So whole-body reads are at parity with Go, and streaming is close. If you read responses from servers you do not trust, read a gzip response through Client.open and ClientStream.read, or pass read_all a max_size you can afford. A bound on send's decoded body, and a Decompressor write that returns at most a given number of bytes as Go's Read does, are planned for 0.52.
linux/riscv64 (LLVM cross builds, known since 0.51.0, not changed here): a program that uses std's constant-time crypto (std/crypto, tls, x509, and std/http through TLS) fails to build for linux/riscv64 with clang: error: unsupported argument 'generic' to option '-mcpu=' when the host's clang config sets -mcpu=generic. The fix is planned for 0.52.
API additions
archive.unzip(data, max_size: Int = 1073741824)andarchive.gunzip(data, max_size: Int = 1073741824): the new parameter has a default, so existing calls compile unchanged.
Xo v0.51.0
Xo 0.51.0 adds format specs to string interpolation ("${n:>6}", "${f:.2f}"), log handlers that send records to files, connections or JSON, an HTTP client with a cookie jar and proxies, and var self methods called through interface values on every backend. It is a security release: it fixes certificate checks that passed when they should have failed, request smuggling, HTTP/2 and other denial of service paths in std/http, a set of denial of service paths in std/json, std/x509, std/tls and std/asn1, and timing side channels in RSA and PKCS #12 (see Security). Interface values are cheaper to build and hold, builds use less memory, and on Windows on ARM (still experimental) a cold build takes about half the time.
Two changes can stop a program that compiled with 0.50.1 from compiling, or change its output: a field whose wire name is - is now left out of JSON, TOML and SQL rows, and protocol errors from std/textproto, std/multipart, std/smtp and the HTTP client quote the line they report (see Breaking changes).
Security
0.51.0 is a security release: upgrade every program built with 0.50.1 or earlier, and rebuild it, since std is compiled into the binary. Unless an item says otherwise, every release through 0.50.1 is affected. Programs built with the Go backend also need Go 1.26.11 or later, which carries Go's own fixes for the same packages.
Certificate checks that passed when they should have failed (std/x509, std/tls; native backends unless noted):
- An IPv4-mapped IPv6 address (
::ffff:a.b.c.d) in a SAN or an IP name constraint is now a parse error, as in Go 1.27.4: such a SAN matched an IPv4 host while escaping IPv4 excluded ranges. - DNS name constraints compare a wildcard SAN case-insensitively, as in Go 1.27.4 (GO-2026-4866, CVE-2026-33810). The Go backend gets this fix only from a Go 1.27 toolchain.
- Chains through the eight compromised intermediates that Go 1.27.4 distrusts are refused (GO-2026-6809).
- An RSA key below 1024 bits no longer verifies a certificate or a TLS handshake signature (native and LLVM); keys of 1017 to 1023 bits were accepted.
Inputs that cost far more than their size (denial of service):
- std/json: seven paths are now linear, including colliding object keys (now hashed with the seeded hash
Mapuses), nested duplicate keys, the stream decoder and TokenReader fed in small writes, and deep decode errors. - std/x509 and std/tls: the policy graph, duplicate extensions, deduplication of intermediates and roots, name constraints (n log n, GO-2025-4007, CVE-2025-58187), host name checks (GO-2025-4155, GO-2026-5037), and chain building, which now stops at 100 signature checks (GO-2026-4946, GO-2026-4947). PEM text is read in linear time (GO-2025-4009, CVE-2025-61723).
- std/asn1: parsing stops at Go's 10,000 nesting levels (GO-2026-5972) and no longer copies the input at each level on the WebAssembly and Go backends.
- std/tls: a peer may send at most 16 records or post-handshake messages in a row that do not advance the connection (empty application data, warning alerts, KeyUpdates, tickets), as Go 1.26.11, on clients and servers.
- std/archive: untar reads an old GNU sparse map to 1 MiB at most, as Go 1.26.11, and the holes of sparse files add at most 1 GiB per archive, checked before anything is allocated.
Script escaping in templates (std/template html mode, native backends): Go 1.26.11's html/template fixes (CVE-2026-56858, go.dev/issue/81821 and 81823): a value after {, }, ${, yield, a keyword property or a #private name in a script is escaped for the right context, <script type=""> is JavaScript, and a meta refresh written url = is filtered.
Timing side channels:
- RSA's fault check of a private key result, and PKCS #12 MAC verification, compare in constant time.
- On Arm, secret key operations run with the DIT bit set, as Go 1.24's crypto does (decision 0619).
- std's constant time modules compile at -O2 even in an LLVM -O0 build.
HTTP (std/http, std/multipart, std/textproto; native backends unless noted):
- Request smuggling and framing: a server closes the connection after a request with both Transfer-Encoding and Content-Length (RFC 9112 6.3); a CONNECT ends HTTP on its connection, as Go 1.26.11 (all backends; GO-2026-6613, GO-2026-6605); a client refuses a Host with CR or LF and writes a User-Agent's CR and LF as spaces (GO-2023-1878); an HTTP/1.1 server never sends a 100 Continue after the response head (GO-2021-0224).
- HTTP/2 denial of service: a header field cut across CONTINUATION frames is decoded once and an empty CONTINUATION is not decoded (GO-2023-1571); SETTINGS and connection WINDOW_UPDATE frames no longer walk every open stream (GO-2026-6611); one connection buffers unfinished request bodies of at most four times
XO_HTTP_MAX_BODY, refusing the stream past it with REFUSED_STREAM; a client drops a response's connection specific fields and an invalid Content-Length (all backends; GO-2026-6610). - Inputs that cost far more than their size: a slowly sent request head and textproto's
read_headerare linear (40,000 fields: 5.8 s to 3 ms; std/mail, std/multipart and std/smtp read headers with it); query parameters stop at 10,000 (all backends; GO-2026-4341); a streamed request's trailer names are capped at 64 (GO-2026-6603);serve_contentignores a Range of more than 200 ranges (GO-2026-6609); multipart reads a part's header in linear time within its limit (all backends; GO-2024-2599, GO-2026-6608). - ReverseProxy forwards a query that does not parse rebuilt from what parsed, so the upstream sees what the rewrite hook saw (all backends; GO-2022-1038, GO-2026-4976), and answers CONNECT 405.
- On Windows, a sub
Fsdenies device names (NUL, COM1, CONIN$, ...) and colons under its root, sohttp.file_servercannot open a device (all backends; GO-2022-1143).
Log forging (std/textproto, std/multipart, std/smtp, std/http client; every backend; GO-2026-5039): protocol errors quote the line they report, as Go 1.26.2 and later do, so a peer's control bytes and newlines cannot forge log lines (see Breaking changes).
Duration parsing (std/time and every duration reader, native backends): parsing a duration text of 20 or more digits past the range, such as 92233720368547758097ns, is an error as in Go; it wrapped to a small value (17 ns).
Highlights
- Format specs in interpolation (decision 0617 A):
"${x:SPEC}"with[[fill]align][+][0][width][.prec][type]:${n:>6},${n:06},${n:x},${f:.2f},${f:e},${s:*^10}. Numbers print as Go's fmt prints the same verbs, on every backend. A spec the value's type does not take is the new error XO0180. - Log handlers (std/log, decision 0617 C):
log.configure_handler(h)sends every record to aHandlerbuilt fromtext_handlerorjson_handlerover a sink (standard error or output, aFile, aConn, or a function), combined withmultiandlevel_rangefor per level destinations. Handlers see typed field values;log.dropped()counts lines a sink failed to write. The call that installs a handler performs its effects, andxo auditlists each install site. - HTTP client cookies and proxies (std/http, decision 0617 B):
Client.with_jar(store, clock)keeps cookies across requests and redirects, as Go'sClient.Jar, withcookiejarconsulting the new std/publicsuffix.Client.with_proxy(url)andwith_proxy_for(f)send requests through an HTTP proxy (https through a CONNECT tunnel, the server's certificate verified), and the new std/httpproxy reads HTTP_PROXY, HTTPS_PROXY and NO_PROXY as Go'sProxyFromEnvironment. var selfthrough interface values (decision 0613 step 5):var l: Loader = Box{}; l.load(3)updates the value in its place on every backend (0.50.1 had it on the Go backend only). A copy of the interface value keeps the old value; a millionloadcalls through one value take 2 ms.- Cheaper interface values (native, LLVM, wasm): an interface value holds its methods as code addresses beside the value in one heap object, where it held a closure per method: building them is about 18% faster, a million values of an 8 method interface take a third less memory (209.9 to 139.7 MB), and calls cost the same.
- Borrowed struct projections are back (decision 0612): off in 0.50.1 while a native arm64 crash was found; that crash was the result clobber 0.50.1 fixed.
- Windows on ARM builds (experimental until 0.52; decisions 0569 and 0388): windows/arm64 builds with the native arm64 backend by default (no
--backend=arm64;--targets=allbuilds all seven targets), and separate compilation is on by default on a windows/arm64 host: a cold build of a program whose std variants are cached takes about half the time (hello 1.6 to 0.8 s, an HTTP service 3.1 to 1.2 s). - Build memory (decision 0448): an SSA value is 7 words, was 9; a large cold test build (aiplatform/apiv1, linux/arm64) peaks at about 4.50 GB, was 4.79.
Breaking changes
- Protocol error text (GO-2026-5039, a security fix): errors from std/textproto, std/multipart, std/smtp and the HTTP client quote the line they report, as Go 1.26.2 and later:
malformed MIME header line: ": v",short response: "12 x", andSmtpErr.display()prints550 "5.1.1 no such user". Migration: a program or test that matches these texts by their old unquoted form compares the quoted one. - Fields named
-on the wire (decision 0622): a field whose wire string is exactly-(as "-",json "-",sql "-") is now left out ofderive Json, Toml andSqlRow, as Go'sjson:"-"is and as Cbor, Yaml and Xml already did; it was the JSON key or column-. Migration: writeas "-,"for the key-. A decoder fills a skipped field with its default, else its type's zero; a skipped field with neither (a struct or enum type) is the new error XO0440.
Behavior changes
- Go backend HTTP proxies: an HTTP client no longer goes through the proxy named by...
Xo v0.50.1
Xo 0.50.1, the first public 0.50 release (0.50.0 was an internal seed), fixes two security issues (a JSON request that could crash a server using json.decode_go, and TLS peer keys over 8192 bits), fixes two crashes (a native arm64 program whose large struct result was overwritten before it was read, and a rare one of programs whose tasks are canceled), adds RSA encryption, reads and writes times of any year from 0001 to 9999 (time.Civil with parse_civil and format, and in std/yaml, std/mail and std/asn1), lets an interface method take var self, writes protobuf messages up to about a third faster, and fixes faults in LLVM builds on linux/amd64. The playground's REPL now needs at most 37 MB of memory.
Upgrade advice: if you build native programs on arm64 (Apple silicon, Graviton) with 0.49.0 or 0.49.1, upgrade; a call returning a large struct could crash them (see Fixes).
Two changes can stop a program that compiled with 0.49.1 from compiling: std/asn1 gains a Value.WideTime variant, so an exhaustive match on asn1.Value needs that arm, and a var method no longer implements an interface method that takes a plain self (see Breaking changes).
Security
- std/tls (native backends): a TLS peer certificate with an RSA key over 8192 bits is refused, with Go's text (
tls: server sent certificate containing RSA key larger than 8192 bits), before any signature is verified. Huge keys made the peer's handshake cost CPU time (Go's CVE-2023-29409, GO-2023-1987). The Go backend already refused them. - std/json (native and LLVM backends):
json.decode_gono longer faults when a type error sits under a non-ASCII object key ({"é": "x"}decoded intoMap[Str, Int]); it returns Go's error,json: cannot unmarshal string into Go value of type int. One such request could stop a server that decodes peer JSON withdecode_go. Found by the decision 0616 review of std/json.
Highlights
- RSA encryption (std/crypto, decision 0618):
crypto.encrypt_oaepandcrypto.decrypt_oaep(RSA-OAEP, Go'sEncryptOAEPandDecryptOAEP) are the recommended scheme;encrypt_pkcs1v15anddecrypt_pkcs1v15are legacy, for systems that require them. Decryption checks padding in constant time and reports every failure as the onecrypto/rsa: decryption error. - Times of any year (decision 0614):
time.parse_civilandLayout.parse_civilread whatparsereads, for years 0001 to 9999 (Go's zero Time,9999-12-31, BigQuery TIMESTAMP), into atime.Civil;Civil.format,Layout.format_civil,Civil.unixandCivil.to_timewrite and compare them.Timekeeps its 1677 to 2262 range. Atime.Civilfield in std/yaml reads and writes any year (four digit years, as yaml.v3),mail.parse_date_civilreads RFC 5322 dates of any year, and std/asn1 parses UTCTime and GeneralizedTime of any year (see Breaking changes). var selfin interfaces (decision 0613): an interface method may takevar self, and a generic bound's call of one (fn fill[T: Loader](var t: T) { t.load(5) }) updates its receiver on every backend (native, LLVM, Go). Through an interface value (var l: Loader = Box{}; l.load(3)) it works on the Go backend, updating the value in its place (a copy made before the call keeps the old value); the native backends still report XO1201 for it.- Faster protobuf (std/protobuf, std/prelude): varints and fixed width values are written as one word, derive Proto writes each field's key with its value (new
put_key_varint,put_key_fixed32,put_key_bytes), andBytesBuilder.write_le,write_byteandStrBuilderpushes store in place. Each step'sxo bench --abon linux/arm64 against the main before it: bench/perf/protobuf marshal 0.856 (varint words), 0.847 (keys with values), 0.827 (write_le); the JSON token writer 0.918 (write_byte). Output bytes are unchanged. - The playground's REPL (xolang.dev/repl/, decision 0583): its compiler peaks at 37 MB over a 30-entry session, was 49 in 0.49.1, and later entries run a little faster.
Breaking changes
- std/asn1 (decision 0614): a UTCTime or GeneralizedTime outside 1678 to 2261 parses as the new
Value.WideTime(c: time.Civil, generalized: Bool)(its wall clock and offset), where it wasasn1: time out of range;derwrites it back in UTC, as Go's Marshal. Migration: add aValue.WideTime(c, g)arm to exhaustive matches onasn1.Value. - Interfaces (decision 0613): a type's
varmethod no longer implements an interface method that takes a plainself(new error XO0439). The checker used to accept it, but a call through the interface would have lost the update, and every native build reported XO1201. Migration: if callers through the interface may change the value, declare the interface methodfn name(var self, ...)and give generic callers avarreceiver (fn fill[T: Loader](var t: T)); if the method only reads, make it a plain methodfn (x: T) name(...).
Behavior changes
- wasm,
BytesBuilder.write_le: a width outside 0 to 8 is the fault the native backends raise (exit 70, the same text), where it trapped ("unreachable", exit 134).
Not in this release
- Borrowed struct projections (decision 0612), listed in the changelog, are off in 0.50.1: a native build of the Azure SDK's pagers crashed (SIGSEGV) with them on. They return when that is fixed.
Fixes
- arm64 native builds: a call returning a large struct (a result wider than the return registers) could have its result overwritten by a value's cleanup call before the caller read it, a segmentation fault (since 0.49.0; 0.48.2 and earlier are not affected). Found through a native build of the Azure SDK's pagers.
- Canceled tasks (native backends and LLVM): a task canceled while it waited for another task to build a constant (a sibling failed while the constant's first read was in progress) now unwinds; it read past an empty list, and the program crashed with SIGSEGV about 1 run in 30 under load. Present since at least 0.48.2.
--backend=llvmon linux/amd64 and freebsd/amd64: a fault (an overflow, a failed contract, an unhandled error) crashed the program with SIGSEGV instead of reporting the fault and exiting 70. Andxo dump(and SIGQUIT) of an LLVM build named the runtime's frame (poll.xo:1187) as a blocked task's site instead of the program's line.- Closures (native backends): a closure with no written result whose body ends in an
ifor amatch(fn(d: Int) { if d > 0 { d } else { 0 } }) builds; it was XO1201 "convertingResult[Int, _]toInt" (the Go backend ran it). - Diagnostics: an XO1201 found while lowering a closure body names the place (the returned expression, else the closure literal or the function); it had no file or line.
- Checker: a type alias reached again through a struct or enum (
type Schema = List[Field]withstruct Field { schema: Schema }) is no longer a false XO0407 "type alias refers to itself". - std/yaml: a
time.Civilfield outside 1677 to 2262 failed to parse, and a year below 1000 was written without its leading zeros (1-01-01T00:00:00Z).
Xo v0.49.1
Xo 0.49.1 adds arbitrary precision floats and rationals (big.BigFloat, big.BigRat), ML-KEM, AES and ECDH, server-sent events and JSON-RPC 2.0 in std, and Go's FileServer and CrossOriginProtection to std/http. xo mcp and xo lsp now run on std/jsonrpc. The REPL keeps changes made through a var (xs.push(5)), and xolang.dev has a new guided REPL page at /repl/. Two native backend fixes matter on upgrade: a program could fail to build with "reads virtual register N before it is written", and a program package named like a std module (a package sse) could fail to link.
Two changes can stop a program that compiled with 0.48.2 from compiling: ProcErr gains a Timeout variant, so an exhaustive match on it needs that arm, and std/protowkt's 32 bit fields are Int32 and UInt32 (see Breaking changes). One behavior change needs a look if you log URLs: http.Url now keeps the user and password, so a URL's display shows the password; log url.redacted() instead (see Behavior changes).
Highlights
- MCP and LSP on std/jsonrpc.
xo mcpanswers batches as JSON-RPC 2.0 says (they were rejected), and a request without"jsonrpc": "2.0"or a method gets Invalid Request with the specification's messages; tools and results are unchanged.xo lsp(andxo dap's framing) read and write throughjsonrpc.HeaderReader(header names without case, a 64 MiB body limit); a message that is JSON but not a request gets Invalid Request. - std/jsonrpc (decision 0603, spec/std.md 80):
encode,decode, a server'sanswer(batches), the newline and Content-Length framings, andConnwith calls and notifications both ways, requests served in tasks, MCP and LSP cancellation, andMethodsdispatch. - std/sse (decision 0603, spec/std.md 79): server-sent events (WHATWG text/event-stream): an I/O free parser (
feed), areaderover any read function,encode,comment,sendandheaders, andsse.Sourceandsse.subscribe, a client that reconnects with Last-Event-ID and the server's retry. big.BigFloatandbig.BigRat(decisions 0602, 0608): Go's big.Float (precision,RoundingMode,Accuracy,sqrt,text,parse_float) and big.Rat (lowest terms,rat_text,float_text, conversions both ways) as immutable values. Natively they are ports of math/big with its fast paths (Lehmer's gcd, mantissas read in place): against Go 1.26.1 on linux/arm64, BigFloat quo takes 0.86 of Go's time, add 1.04, mul 1.19 and sqrt 1.29; BigRat add and mul 0.88 and parse 0.74 (bench/results/bigfloat-vs-go-2026-11-11.md, bigrat-vs-go-2026-11-11.md).- Cryptography (spec/std.md 11): ML-KEM-768 and 1024 key encapsulation (Go's crypto/mlkem; encapsulation in 0.29 of Go's time, key generation 0.56, decapsulation 0.59, bench/results/mlkem-vs-go-2026-11-11.md), the AES block with the CBC and CTR modes (Go's crypto/aes and crypto/cipher; CTR in 0.86 of Go's time, CBC encryption 0.54, through the same hardware kernels as AES-GCM), ECDH over X25519, P-256, P-384 and P-521 (Go's crypto/ecdh), and
crypto.xor(subtle.XORBytes). - std/http:
file_server(fs, strip), Go's FileServer over an Fs: the Fs is the sandbox, soos.fs.sub(dir)orembed.Dir.fs()serves only what it holds.cross_origin(trusted, bypass)withcheck(req)andmiddleware(), Go's CrossOriginProtection.http.Urlgainsuserandpassword(defaulted fields, so every literal still compiles), and a client request to a URL with a user sends Basic authorization unless it sets its own. - The REPL: an entry that changes a
varbinding through a method call (var xs = [3, 1, 2], thenxs.push(5)) is kept, wherexsstill printed[3, 1, 2];xo query typenow answers for avar's name. In the playground's REPL,:type EXPRanswers with the expression's type and values print with their types (every:typesaid "sess/main.xo is not part of the checked modules"). xo replcommands::help(also:hand:?) lists the commands and the editing keys,:tis short for:type, and alt-Enter starts a new line in an entry that is already complete, as Shift+Enter does in the browser REPL.- xolang.dev/repl/: a full-height REPL beside a guided walkthrough of the language (values, bindings, functions, structs, enums and match, lists and maps, std, errors, the REPL's commands), each entry one "type it" button away. It runs in the browser, in WebAssembly, like the playground.
Breaking changes
- Prelude (decision 0611):
ProcErrgainsTimeout(i/o timeout), returned by the newChild.set_read_deadline(clock, t), Go'sSetReadDeadlineon a child's output and error pipes (read,read_errandread_linefail past the deadline; a timed outread_linekeeps its partial line;Noneremoves the deadline). Migration: add aProcErr.Timeoutarm to an exhaustivematchonProcErr, or a_arm. - std/protowkt (decision 0549): the fields protobuf-go types int32 or uint32 take Xo's Int32 and UInt32, where they were Int:
Timestamp.nanos,Duration.nanos,Int32Value.valueandUInt32Value.value. Migration: convert where a program builds or reads them withInt32(n)(faults out of range;Int32.try(n)gives an optional) andInt(t.nanos). The well known types now derive Proto, soprotobuf.marshalandprotobuf.unmarshaltake them, and Empty keeps its unknown fields as protobuf-go does.
Behavior changes
- std/http
Urlkeeps its user and password:parse_urlused to drop them. A URL's password now reaches its display, so logredacted()instead. An empty userinfo (http://@host) reads as none. - Go backend, std/http:
Request.query_allunescapes each pair in order with std/url'squery_unescape, as the native backends do, so two keys that read as one name come back in the query's order on every backend (Go'surl.ParseQueryreturned map order). - Go backend, std/regexp: the Go backend runs the same Xo engine as the native backends (it called Go's regexp), so its matches and errors are the native ones.
xo mcp: a request without"jsonrpc": "2.0"or without a method is answered with Invalid Request instead of being served.
Fixes
- Native backends, "reads virtual register N before it is written" (arm64 and amd64): a function that passes a value into an inlined callee that faults on it (a constructor's argument check from another module) could fail to build. The block the unwinder enters from that check reused a constant its normal predecessor had made.
- Native backends, a package named like a std module: a program package named like a std module the program does not import (a package
ssebeside std/sse) shared that module's symbol names, and a separately compiled build could fail to link with a duplicate symbol. Such a package's functions are now named by its path. xo test, FakeNet patterns (native backends): a pattern and a request's path split as the Router splits them, as on the Go backend:{rest...}takes""on/and after a trailing slash, a pattern ending in/is a subtree,{$}the exact slash path, and/users/{id}no longer answers/users/7/. Since 0.46.0,os.net.handle("GET https://h.test/{rest...}", ...)answeredhttps://h.test/with "no fake handler" natively.use c, C parameters namedn,v,corr: a C function whose parameters are named like the locals of xo's C adapter, or like the function itself, failed to compile ("redefinition of 'n'" for a Bytes result) afterxo checkpassed. The adapters' own names are prefixed now, and a failed adapter compile names the header declaration it came from.- Build cache: a link's cache key holds the environment the linker reads (XO_BRANCH_REACH, XO_DATA_SHIFT, XO_STD_HALF), so a link made with XO_BRANCH_REACH is no longer served to a build without it.
- Front end cache: a closure's cache entry (a std closure such as tls's, recorded in one program and reused in another) replays where the types it uses were not made yet, where the build printed "the front end cache entry ... did not replay" and was built a second time without the cache.
xo test --std-module: a module that another module's declaration file imports (std/http.xo'suse std/multipart) is tested with that importer built from source:xo test --std-module=multipartfailed with XO0601 once std's test variants were cached.- std/http:
r.with_host(h).host()ishon the native backends (it gave the Host the request came with). - std/crypto: a P-256 public key with a coordinate at or above p fails with Go's text (
invalid P256 element encoding). - std/smtp: DATA dot-encodes as Go's DotWriter. std/multipart: a bad header value's error shows the key in canonical form, as Go's.
- Separately compiled constants: the fix of 0.48.2 (a program's constants number past std's) is on main too.
Standard library
- New modules: std/asn1 (Go's encoding/asn1 as a DER value tree:
parse,parse_prefix,Value.der,oid; struct marshaling by field tags is a later stage, decision 0601), std/textproto (Go's net/textproto over bytes in memory:canonical_key,Header,Reader,dot_encode), std/random (Go's NormFloat64, ExpFloat64 and Perm over any Rand), plus std/jsonrpc and std/sse above. - Prelude:
look_path(env, fs, name)(Go's exec.LookPath),create_temp_dir(fs, dir, prefix)(os.MkdirTemp),File.seek(offset, whence)withWhence(os.File.Seek; MemFs files too),Bytes.trim_start_charsandtrim_end_chars,List.is_sorted,Float.copysign,frexp,ldexp,Float32.maxandsmallest_nonzero. - std/netip:
AddrPort(parse_addr_port,addr_port),split_host_portandjoin_host_port(host names too, Go's error texts),Addr.prefix,next,prev,with_zone,prefix_from,Prefix.bits,is_single_ip,overlaps. - std/sql:
Rows.column_typesandRow.column_types(Go's ColumnTypes), filled by the Postgres, SQLite and in-memory dr...
Xo v0.48.2
Xo 0.48.2 fixes two bugs of separate compilation (the default for a native build, run or test since 0.34.0). A program with a few constants of collection types could crash or silently read wrong values when it also ran std code with constants of its own (every platform). And on windows/amd64, once std's prebuilt stores were cached, a program that uses concurrency was linked against std's single-threaded store: HTTP servers faulted and some programs using std/sql did not link. Both are in 0.46.0, the last release. Everyone on 0.34.0 or later should upgrade. On an older version, set XO_SEPCOMP=0 to avoid both (or build with --release, or the LLVM backend, for the first).
0.48.2 also carries everything of 0.48.0, which had no release of its own. Since 0.46.0, Xo reaches the user's secret stores (the Linux kernel keyring, the macOS keychain and Windows' DPAPI, each with an in-memory fake in tests), builds C libraries as Windows DLLs, reads multipart bodies as they arrive, adds Go's slices, maps, strings.Replacer and io.Copy helpers to the prelude, rebuilds small programs faster, and runs std/sqlite on FreeBSD.
Upgrade if you build small programs often, or if a program uses std/base64 together with another std module such as crc32 (it could fail to build with XO1201). One change can stop a program that compiled with 0.46.0 from compiling: std/amqptest's broker methods declare the clock effect (see Breaking changes).
The fixes in 0.48.2
- Constants read from the wrong slot (gotchas/sepcomp-const-ids-shared-with-std.md): a constant of a List, Map, Set or Bytes type, or one computed by a call, lives in one table of the process, read by a number the compiler gives it. A separately compiled program numbered its constants from 0, as std's prebuilt store numbers its own, so a program constant and a std constant could share a slot. A program with five such constants calling
mime.detect_content_typecrashed with SIGTRAP on 0.48.0 (150 constants on 0.44.0 and 0.46.0); in other orders it crashed with SIGSEGV, or read another constant's value with no crash (xo test --std-module=mimereturned wrong content types). The program's constants now number from 2048, and building std's store fails loudly if std ever has 2048 of its own. Native backends only: LLVM, wasm and Go builds, and--releasebuilds, compile std with the program and were never affected. - Windows: concurrent programs linked against the single-threaded std (windows/amd64): std's prebuilt store comes in two forms, with and without concurrency support, and the Mach-O and ELF links pick by the program. The PE link read only one of them, so once both were cached, a program that uses concurrency got the other: on 0.46.0 with both stores cached, an HTTP server and an HTTPS server faulted, and two programs using std/sql failed to link (0 of 4; with
XO_SEPCOMP=0, 4 of 4). Now the PE link picks the store as the others do. On an older version, setXO_SEPCOMP=0(orXO_SEPCOMP_DEFAULT=0) on windows/amd64.
Breaking changes
- std/amqptest (decision 0591):
Broker.event_hub,put,ready,lockedandscheduleddeclareuses clock, since they read the broker's clock. Migration: a caller that passes them as a purefn(a closure, say) needs theclockeffect.
Platforms
- Windows DLLs (decision 0574):
xo build --lib=sharedbuilds a DLL for windows/amd64 and windows/arm64 with Xo's PE linker, exporting the runtime's and theas cfunctions by name; the runtime starts on the first call (DllMain starts nothing), each thread's runtime state is released when the thread exits, and XoBytes and XoStr cross by reference as Win64 passes them.-o geo.dllwrites the header geo.h and the import library geo.lib, which MSVC's link.exe and lld-link link a C program with.--libnow exports theas cfunctions even with no-o. - FreeBSD (experimental, decision 0573): std/sqlite builds and runs on freebsd/arm64 and freebsd/amd64 (a database file in WAL or rollback journal mode; SQLite's
localtimeis UTC there). Ause cbinding's C may call printf's family,<ctype.h>, calloc, realloc, the str functions, memchr, strtol and atoi, though an Xo program on FreeBSD links no C library: Xo's runtime and a small C file the build adds define them. A static link names every missing function at once. - windows/arm64 (experimental, decision 0569): a program built against std's separately compiled store no longer crashes before main (a branch between two atoms of an object was resolved in place, and the store's layout moved them apart).
Language and prelude
- Float type constants (decision 0592):
Float.inf,Float.nan,Float.pi,Float.e,Float.max,Float.minandFloat.smallest_nonzero, asInt.max(Go's math.Inf, NaN, Pi, E, MaxFloat64, SmallestNonzeroFloat64). - Lists and maps (decision 0592):
List.clone(),List.concat(lists),binary_search(x),max()andmin()(Go's slices.Clone, Concat, BinarySearch, Max and Min);Map.extend(other)andMap.clone()(maps.Copy and maps.Clone). - Copying streams (decision 0593):
copy_stream(dst, src),File.copy_to(dst)andFile.copy_from(src), withCopyErr[R, W](Go's io.Copy between connections and files). Replacer.new(pairs)andr.replace(s)(decision 0594): Go's strings.Replacer, one pass over several old and new pairs.- Runes, integers and time (decision 0595):
Rune.max,Rune.max_ascii,r.simple_fold(),n.bit_len(),n.add_carry(m, c),n.sub_borrow(m, b),t.unix_micros(),t.unix_nanos(),t.nanosecond(),Time.from_unix_microsandTime.from_unix_nanos.
Standard library
os.secrets(decision 0584): the user's secret stores.Secrets.keyring()is the Linux kernel keyring (Keyring.add,search,read,unlink,user_persistent,KeyErr);keychain()the macOS login keychain's generic passwords (get_generic,set_generic,delete_generic,KeychainErr);dpapi()Windows' Data Protection API (Dpapi.protectandunprotectwith optional entropy,DpapiErr), withEnv.local_app_data(). In a test, each is an in-memory store on every OS, empty per test. AnOsliteral withoutsecretshas none.- std/multipart (decision 0597):
multipart.reader(src, boundary)reads a body's parts as they arrive, as Go's multipart.Reader does (next_part,read,PartHead.header_values); it is effect generic, so the source may read a connection.http.BodyReader.multipartis built on it. - Fixed:
UuidErr.msgispubagain (decision 0440).
Tools
- Warm builds of small programs reuse their generated code: a separately compiled program of fewer than 256 functions skipped the function cache and generated all of its code on every build. The collections benchmark's warm rebuild went from 110 to 53 ms on linux/arm64, with a byte identical binary.
- Build time (arm64 and amd64 native backends): two code generation passes that were quadratic in a block of many word loads are linear; output unchanged.
xo test --std-moduleafter an edit uses about half the memory: std's test variant now holds facts for every std function, and a test build loads std's declarations from their record and parses std's trees only where needed, asxo builddoes (decision 0596).- xo lsp: go to definition and peek on a std name open its implementation in std's native sources (
Str.split_where,http.Request), not the bodyless declaration; a name with no implementation (an intrinsic) keeps its declaration. New:textDocument/typeDefinition. - The playground's compiler parses runtime bodies only when it checks them and skips test files, as
xo builddoes, and can load std from its declaration record; a wasm program's memory grows by a quarter instead of doubling. The playground's 30-entry REPL test session (headless Chrome) went from 608 to 265 MB of memory (decision 0583).
Fixes
- std/base64 with std's declaration record: a program using std/base64 and another module in the record (crc32, say) failed with XO1201
base64.encode(decision 0588). - Windows drive paths:
xo doc --dir=C:\x\appread the directory alone,xo query --dir=C:\xmissed callers in the workspace's packages, and xo serve never forwarded a lookup with a drive path (and keptC:\xandC:/xas two cache entries). xo doc stdsummaries of the std modules merged with their implementation (decision 0588), and of std/amqptest, std/timego, std/base32 and std/uuid, read their description again, not an origin or license line.- Interfaces: a call through an interface that omits an argument uses the interface method's default on the native backends (it was XO1201).
xo dev new-golden --dir=DIRwith an absolute DIR wrote under the checkout; the directory is used as given.
Known issues
- windows/arm64's native backend is not the default yet (decision 0569).
Xo v0.46.0
Xo 0.46.0 adds FreeBSD (amd64 and arm64) and linux/riscv64 as experimental cross targets, makes xo check about six times faster on a warm run by reading std's declaration record instead of checking all of std, matches routes as Go 1.22's ServeMux does, gives xo repl a JSON protocol and editing, and fixes a host name lookup that could return wrong IPv4 addresses.
Upgrade if your programs look up host names on networks with both IPv4 and IPv6, or if xo check time matters to you. Two changes can stop a program that compiled with 0.44.0 from compiling or change how it answers requests: std/http's Router matching, and exhaustive matches on TargetArch or TargetOs; a third makes some existing xo.lock lines fail to verify (see Breaking changes).
Breaking changes
-
std/http
Routermatches as Go 1.22's ServeMux. A pattern without a trailing slash is an exact path (GET /healthzno longer answers/healthz/), a pattern ending in/is a subtree route,{$}is the exact slash path,{name}needs a non-empty segment, unclean paths get a 307 to the cleaned path, aGETroute servesHEAD(it was a 405), and a 405'sAllowis sorted withHEAD. Migration: register the exact path and, for a tree, a/dir/or{p...}route. -
TargetArchgainsRiscv64andTargetOsgainsFreeBSD(decisions 0571 and 0573), so an exhaustivematch target.archormatch target.oswith no_ =>arm is now XO0301 on every target. Migration: add the new variant to an arm (Linux | FreeBSD => ...,Arm64 | Riscv64 => ...) or add_ =>; XO0301 names the missing variant. -
A module in a subdirectory of its repository carries the repository's root LICENSE (decision 0590) when it has none of its own, as Go's module zips do, so its zip hash changes. An
xo.lockline for such a module written by an older xo now fails with XO1304, with a note naming this change. Migration: delete the line and runxo mod tidy.
Platforms
- FreeBSD (experimental cross target, decision 0573): programs build with the native backends for freebsd/amd64 and freebsd/arm64, with threads, the kqueue poller, signals, the file system, sockets, HTTP and TLS, faults recovered by isolate and defer, and asynchronous preemption (a loop with no call yields as on Linux). Every golden program that builds passes on both (642 of 642, in FreeBSD 14.5 VMs).
use cbindings compile with clang against a FreeBSD sysroot (C that calls the C library is not supported yet). FreeBSD is not in--targets=alland has no prebuilt xo. - linux/riscv64 (experimental cross target, decision 0571):
xo build --targets=linux/riscv64 --backend=llvmbuilds 64-bit RISC-V Linux programs (RV64GC) against a riscv64 glibc sysroot (XO_LINUXSYSROOT), with asynchronous preemption; LLVM backend only, not in--targets=all, no prebuilt xo. Under qemu-user all 523 LLVM goldens that need no network pass, and std's 60 test modules. - windows/arm64 (experimental, decision 0569):
use cprograms link with Xo's PE linker, weak C references work, functions over 1 MB get segmented unwind data, a debug build writes a PDB, and--backend=arm64assembles with Xo's own COFF writer, so a build needs no clang unless it has ause csource. The native backend is not yet the default there. - Windows debuggers: WinDbg and cdb load the PDB xo writes on windows/amd64 and windows/arm64.
xo debugon Intel Macs (darwin/amd64, decision 0253): runs, steps and attaches to programs, with backtraces through x86_64's compact unwind data; it said "xo debug runs programs on macOS arm64, Linux and Windows".
Language
- Integer bounds are type constants (decision 0587):
Int.max,Int.minand every sized integer type's bounds (Int8.min,UInt64.max) work in aconstor a pattern;Int.max(a, b)is XO0407 naminga.max(b). - Effects (decision 0582): an interface value's effect argument widens where the interface's effect parameter is covariant, so a
Cred[fs.read]may go where aCred[(fs.read, proc)]is expected. Os { ... }may leave out fields (decision 0585): each omittedfs,net,env,procorstdiodenies everything, so a test or sandbox names only what it grants.- C libraries (decision 0574):
xo build --lib=sharedor--lib=staticbuilds a package as a C library with a generated header (NAME.h), andpub fn add(a: Int, b: Int) -> Int as c "geo_add"is its C functiongeo_add. Int, Float, Bytes (XoBytes) and Str (XoStr, UTF-8 with a length, no NUL needed) cross directly; any other value but Bool and functions crosses as anXoHandlethat C releases withxo_release. A function that can fail (-> T ! E) takes anint32_t *errlast and leaves the error's text forxo_last_error(). The runtime starts when the library loads, and any C thread may call in. Works on darwin and linux, arm64 and amd64, with the native backends, linked with cc. Not yet: Windows DLLs, the LLVM backend, Optional and List results except as handles, and Bytes borrowed without a copy.
Tools
xo checkreads std's declaration record (decision 0388) and parses std's trees only where a body is needed: a warm check of fib went from 352 to 56 ms and of bench/perf/http from 365 to 52 ms on the Mac; output unchanged (XO_STD_EXPORT=0 restores the earlier path).xo replno longer needs XO_REPL=1 (it stays experimental):--jsonspeaks one request and one reply a line,--effects=LISTlimits what entries may use,:defs,:saveand:loadmanage a session, redefining a fn or type replaces it, and a terminal session edits entries in place with history.- Diagnostics for code written the Go way:
if v, ok := m[k]; ok {is one XO0177 namingif let Some(v) = m.get(k);"n = " + nnotes the interpolation form;xs.sort(fn(a, b) { a > b })is one XO0403 namingsort_by; XO0701 names the correctedusesclause with a machine-applicable fix;xo vetXO0542 warns ofx ?? lit <op> z. xo check --fixparenthesizes its.or(x)to??rewrite when an operator is next to it (m.get(w).or(0) + 1becamem.get(w) ?? 0 + 1, which adds 1 to the default only).- xo lsp: hover on std names links to the std reference page, and a std source opened in the editor is not checked as a module. Every prelude fn now has a doc comment.
- Module tools (decision 0568):
xo mod sumdb keygenandserve,--copy-toandrestore,--refresh, andxo mod proxy fillrun a checksum log and module proxy; every git fetch fails a remote slower than 1 KB/s for a minute instead of hanging. - xo init writes .gitignore only inside a git repository.
xo vetXO0541 warns of araw.bytes_bufslice kept past the loop iteration that reads into the buffer again, without.clone()(a Bytes slice is a view).
Fixes
- Windows:
xo fix,xo check --fixandxo modoutside a module no longer loop forever: the search for xo.mod stops at the drive's root (C:/). <!-- CHANGELOG Unreleased: Fixed (Windows): xo fix, xo check --fix (5c4b5f2a...
Xo v0.44.0
Xo 0.44.0 fixes a native HTTP server on Linux that stalled on pipelined requests whose sender closed its side right after writing them, brings std/sqlite to windows/amd64 with no C compiler needed, adds destructuring assignment ((a, b) = (b, a), struct and list targets), and makes many byte and string paths faster with 32 byte vector scans on arm64 and amd64. std/cli gains Go flag forms for ports of Go tools, and std/sql's drivers carry their effects.
Upgrade if you run a native HTTP server on Linux behind clients or proxies that pipeline requests. No change in this release stops a program that compiled with 0.41.0 from compiling, with one possible exception: code that keeps a sql.Db in a closure whose type fixes its effects now names the effect argument (see below).
Breaking changes
None marked breaking. Changes you may notice:
- std/sql drivers carry their effects (decision 0534):
Driver,DriverConn,DriverRows,DriverCursor,Db,TxandRowstake an effect parameterfx, andopen_driverreturnsDb[fx], so std/sqlite's Db performsfsrather than claimingnet.dial.sql.Dbwithout the argument stays valid; code that keeps a Db in a closure with fixed effects names it,sql.Db[()]for Postgres and the in memory driver, andxo fixwrites that for you. xo checkon a directory inside std (xo check std/...) exits 2 with a usage message;xo test --std-module=Mchecks a std module.- List targets of a destructuring assignment (
[a, b] = xs) report XO0303, aslet's list patterns do (they were XO0502).
Language
- Destructuring assignment (decisions 0536 and 0538):
(a, b) = (b, a),(q, r) = divmod(x, y)and(p.x, xs[i], _) = tstore a tuple's elements into existing places, andP{x, y} = porP{x: st.lo, ..} = pstore a struct's fields, the value first, then each place left to right; XO0539 for a place named twice. - Effects and interfaces (decision 0540): a method whose parameter type leaves its effect arguments out (
next: Next) satisfies an interface method that writes them (next: Next[fx]); it was XO0701.
Fixes
-
A native HTTP server on Linux answers pipelined requests whose sender closed its side right after writing them; each such connection stalled until its sender gave up. A known issue of the 0.43.0 seed, never in a public release.
-
A type with a method named
debugordisplaythat takes parameters (a generated API client'sdebug(project, zone, ...)) builds; formatting such a value called that method with only its receiver, which stopped native builds with XO1510, LLVM with a clang type error and Go with a compile error. -
A stack overflow on Linux and macOS is reported as "fatal error: stack overflow", as on Windows; on macOS it read as a bus error.
-
Native backends: a closure that captures more than 32,760 bytes of words builds (a generated GCP client's service); a method of a struct with an effect parameter called through an interface value compiles;
==on a value holding anhttp.Responseorhttp.Requestcompiles; each was refused before. -
Go backend: a struct with no fields and
derive Json, two types' methods of one name with default arguments,returnof an if or match mixingTvalues andErr(e), a std module's constant read from user code, andxs.contains(x)on a list of a user type all build and run again. -
Test worlds: a FakeNet handler's streamed body reaches
Client.sendandClient.opennatively, and a read or write that waits past its deadline ends withTimeouton the Go backend (it reported a deadlock). -
Cross builds of a program with a
use csource to darwin/amd64 from Linux, or to windows/amd64 with no sysroot, stop with a message that says what is needed instead of a C compiler error. -
Debugging: lldb on macOS shows a string literal held in a variable correctly in a separately compiled build, and
xo debug'stask Non a task std spawned selects the first frame outside the runtime. -
std/amqp: an unsettled
sendwith the reader task running no longer waits forever. -
arm64 programs with more than 128 MB of code no longer crash in reference counting: a retain or release whose object sat in x16 went through a linker branch island that sets x16 (a generated GCP client's tests stopped with SIGSEGV).
-
Native backends: a recursive value (a Box) of more than 32,760 bytes of words builds, and structs, tuples and enums of that size compare.
-
Linux with 64 KiB pages: freeing a 32 KiB heap block no longer discards the pages of the block beside it.
Standard library
- std/sqlite on windows/amd64 (decision 0534 stage 2): linked by xo's own PE linker, with prebuilt SQLite objects in the release, so a program using std/sqlite builds with no C compiler;
use ccalls on windows/amd64 use the Win64 convention. - std/cli for ports of Go tools:
single_dash_long: truereads-name,-name=valueand-name valueas the long forms (decision 0547),stop_at_positional: trueends the flags at the first positional argument as Go's flag package does (decision 0556), andbool_flag(..., default:)sets a flag's value when it is absent. BytesBuilder.write_le(v, n)andwrite_be(v, n)append the n (0 to 8) low bytes of a word in one step, on every backend (decision 0561).- std/json
derive Json(match: fold)decodes object keys as Go's encoding/json does (an exact key first, else the first field whose key folds equal) (decision 0550). - std/sql's memory driver takes
CREATE INDEXandDROP INDEX(PostgreSQL's syntax, one column), so aWHERE column = valueon an indexed column visits only the matching rows. use c: a C function returning a struct of a const byte pointer and a length binds as aBytesresult, NUL bytes kept; a std module's binding can name its handle types in the module's own types.- std/amqp and std/amqptest: desired capabilities on links (Event Hubs v2 geo-replication), an event hub's
georeplication_factor, andBroker.attaches(). <!-- CHANGELOG v0.44.0: std/amqp:SenderOptions.desired_capabilities; std/amqptest: an event hub's READ reply -...
Xo v0.41.0
Xo 0.41.0 fixes a native HTTP server that could hang on SIGTERM (0.36.0 to 0.40.0), checks a dependency's function bodies only as a build reaches them, so builds of large module graphs take less memory, and makes the edit loop faster: a one-line compiler edit rebuilds xo in 10.7 to 13.7 s on the Mac instead of 49 to 65 s. std gains CBOR with derive Cbor, and /debug/sched reports open fds and pending timers for long-running services.
Upgrade if you run a native HTTP server with keep-alive clients. One change can stop a program from compiling: cbor.CborErr has a new variant, so an exhaustive match on it needs an arm for Type.
Breaking changes
- std/cbor:
CborErrhas a new variant,Type(msg); amatchonCborErrthat lists every variant fails to compile until it handlesType.
Other changes you may notice:
xo buildandxo runcheck a dependency's function bodies only as they reach them (decision 0517): a type error in a dependency function the program never calls no longer fails the build.xo check,xo testandxo vetof the dependency still report it, andXO_DEP_LAZY=0checks every body. s3 + dynamodb on linux/arm64: peak RSS 932 to 631 MB, cold 4.44 to 4.01 s.xo getchecks each newly required module version once and prints a warning with its first errors; the requirement is still added.XO_GET_CHECK=0skips it.xo run DIR/main.xoruns the program of DIR instead of stopping with a usage error.- A native HTTP server's responses written after a stop request carry
Connection: close, as net/http's after Shutdown. xo check DIRruns the native support check by default (decision 0523): every function of the named directories' modules, a library's too, so what a native build would refuse (XO1201) shows at check time. A walk (DIR/...) runs it only with--support;--support=falseskips it. Ause goprogram now fails plainxo check, as its native build does;--backend=gochecks it by the Go backend's rules.
Fixes
- A native HTTP server no longer hangs on SIGTERM or a stop request when a kept-alive connection answered a request in the 20 ms before the stop (arm64, amd64 and LLVM backends; 0.36.0 to 0.40.0).
- Native backends run more function values: a function value with
varparameters (a named function passed as a value, a stored closure, one that fails with?),Mutex.withgiven a function value that is not a closure literal, and a value whose type differs only in effect arguments (Request[env]asRequest[fx]) now build and run; each said XO1201 where the Go backend ran it. - Effects: a type with an effect parameter implements an interface with one when the arguments agree (
ProcProvider[env]asProvider[env]), where it was XO0701. - WebAssembly: a function value or closure with a parameter or result of more than 256 leaves is called by memory, so such programs build and run on wasip1 and wasip2.
- Go backend: a std method with a
varreceiver in a module the Go backend compiles from its native implementation builds (it said there was no route). xo serve: a cached check no longer keeps answering its old result after an edit to another directory of the module.xo check --supportof a large workspace no longer holds every module in one checker (aws's 438 modules passed 18 GB), and no longer reports a false XO1201 for a shared module's bodies.- A syntax error in a lazily checked dependency body is reported at its file and line and fails the build; it was a compiler fault.
Standard library and runtime
- std/cbor (decision 0527):
derive Cbor,cbor.marshal[T],cbor.unmarshal[T]andcbor.unmarshal_prefix[T]with fxamacker/cbor v2's rules and tags (key,omitempty,keyasint,toarray); 2,000 typed cases agree with the oracle. - std/amqp (decision 0521):
message_formaton send (Service Bus batches), manual credit (credit: 0,issue_credit,drain),ReceiverSettleMode.Second, annotations onmodify, andremote_attach(). - std/sql's memory driver indexes UNIQUE INT and TEXT columns and writes tables in place (decision 0528): on linux/arm64 a lookup by UNIQUE column on 10,000 rows takes 0.002 of its time before and INSERT plus DELETE 0.003, and the notes service serves 1.58 times the requests at saturation.
- For long-running services:
/debug/schedreportsfds_openandtimers_pending, andXO_CRASH_FILE=PATHappends a fault report with its traceback to PATH as well as standard error (Linux and macOS), like Go's debug.SetCrashOutput. - Heap: 2 and 4 KiB buffers take 1.27 times their size instead of 2.01, and sizes from 1 to 8 KiB 1.03 to 1.06 times instead of up to 1.41 (decision 0506).
- Profiling: a CPU profile holds 262,144 samples instead of 32,768, and one that still fills its ring says PROFILE INCOMPLETE with the share lost and the XO_PROF_HZ that would keep them all.
Speed and memory of the toolchain
- Edit loop: a one-line compiler edit rebuilds xo through xobuild in 10.7 to 13.7 s on the Mac instead of 49 to 65 s; on linux/arm64 a warm one-line compiler edit went from 17.5 s to 8.2 to 8.3 s wall now that a cc link reuses unchanged objects (121 of 127).
- Warm builds: the first edit after a cold build is warm (s3 + dynamodb: 0.34 s, was 1.17 s), the second reuses the caches of the one before (0.33 s, was 0.58 s), and a cold build is no longer slowed by the background build of std (4.50 to 4.56 s, was 5.22 to 5.36 s).
- Build memory: a cold build of s3 and dynamodb peaks at 822 MB instead of 932 (1,108 MB two steps back).
- Compiler: a cold build of xo takes 0.972 of the wall and 0.956 of the CPU of before, output identical.
- Editor:
xo lspusesxo check's module check cache (first diagnostics on compiler/ssa/build.xo 537-758 to 355-399 ms), references take 142 to 148 ms instead of 622 to 733, andxo def,refs,type,symbolsanddocare answered by a runningxo serve.
Diagnostics
- An XO0701 that asks for an effect also names the callers that will need it, so one round of edits fixes the chain; XO0701, XO0702, XO0202, XO0401 and XO0502 teach the threaded effect form (guide: knowledgebase/guides/effectful-closures.md);
parse_intand friends point toInt.parse; an unknown field or method lists what the type has. - A type mismatch (XO0401) between two types that print alike, such as a module's own
struct Connagainst the prelude'sConn, names each by its module path and notes where the module's type hides the prelude's; it read "expectedConn, foundConn". - A
${...}whose closure spans lines inside a one-line string is one error at the${saying to bind the value withletfirst (it was five errors ending at the closing brace)...