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

layouttest

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package layouttest generates the per-package ABI layout regression test both frameworks emitters (raw and idiomatic) write: a reflect-based check that every emitted value/byte-array struct reproduces the authoritative C ABI size clang reported. It is the layout gate the name-keyed parity check cannot provide.

SCOPE — shared: used by both the frameworks raw and idiomatic emitters (and available to the libraries pipeline). It is emitter-agnostic — callers supply the resolved Check list.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Write

func Write(outDir, pkgName string, checks []Check) error

Write emits <pkgName>_layout_generated_test.go into outDir asserting each check. It writes nothing when there are no checks.

Types

type Check

type Check struct {
	GoName string
	Size   int
	Align  int
}

Check is one struct's Go name and the authoritative C size / alignment. Align 0 skips the alignment assertion (used for clean value structs, where Go may legitimately over-align an int64-bearing struct without an ABI consequence).

Jump to

Keyboard shortcuts

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