Help us shape the future of Go! Take the 2026 Go Developer Survey

mainactorisolation

command
v0.20.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Command mainactorisolation harvests Swift @MainActor isolation facts for Objective-C frameworks and writes them into per-framework sidecar files (mainactor.json) next to the committed .gometa.json metadata.

Why a separate tool (and not the scanner): Apple expresses main-thread affinity as Swift's @MainActor. In the headers it is the macro NS_SWIFT_UI_ACTOR, which expands to __attribute__((swift_attr("@MainActor"))). Clang parses the attribute, but `clang -ast-dump=json` — the form the scanner consumes — omits the swift_attr argument string, so the isolation is invisible on that path. The Swift symbol graph carries it faithfully (as the s:ScM attribute fragment), so this tool drives `swift-symbolgraph-extract` and reads the isolation out of the resulting symbol graph.

The committed sidecars let `go run ./cmd/generate/ idiomatic` apply the isolation without a Swift toolchain, exactly as appledocs.json works.

Usage:

go run ./scripts/tools/mainactorisolation fetch --framework AppKit
go run ./scripts/tools/mainactorisolation fetch --framework AppKit,WebKit
go run ./scripts/tools/mainactorisolation fetch --framework all

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL