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

core

package
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: 2 Imported by: 0

Documentation

Overview

Package core holds the naming helpers that are identical across the frameworks (purego) and libraries (cgo) pipelines, so both pipeline-specific naming packages re-export them from a single source instead of keeping divergent copies.

Only behavior-identical helpers live here. Functions that genuinely differ between the pipelines — ParamName (the frameworks pipeline camel-cases snake_case and lowers leading acronyms as a unit; the libraries pipeline only lowercases the first letter) and each pipeline's goReservedWords set — stay in the pipeline packages. Bridge-symbol helpers (libraries) and selector/class var-name helpers (frameworks) also stay pipeline-local.

SCOPE — shared: only behavior-identical naming helpers. Pipeline-specific naming stays in internal/codegen/frameworks/naming and libraries/naming.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Capitalise

func Capitalise(s string) string

Capitalise returns s with its first Unicode letter uppercased.

func ExportedFunctionName

func ExportedFunctionName(symbol string) string

ExportedFunctionName maps a C function symbol to its exported Go name. Symbols that are already exported (first byte 'A'–'Z') are returned byte-identical so existing consumers of CFArrayCreate / SecItemAdd / CSSM_CL_CertSign never see a rename. Unexported symbols are converted to PascalCase: split on '_', drop empty segments, capitalise each segment's first letter, join.

vmnet_start_interface      → VmnetStartInterface
vImageBoxConvolve_ARGB8888 → VImageBoxConvolveARGB8888
_MPIsFullyInitialized      → MPIsFullyInitialized
CFArrayCreate              → CFArrayCreate (unchanged)

Returns "" when no exported Go identifier can be derived.

func ExportedTypeName

func ExportedTypeName(name string) string

ExportedTypeName maps a C type name to an exported Go type name using the same rules as ExportedFunctionName (already-exported names byte-identical, snake_case → PascalCase).

func GoTypeName

func GoTypeName(name string) string

GoTypeName ensures a type name is exported (first letter uppercase).

func MethodName

func MethodName(selector string) string

MethodName converts an ObjC selector to an exported Go method name.

"objectAtIndex:"                        → "ObjectAtIndex"
"writeToURL:error:"                     → "WriteToURL"  (NSError** arg elided by scanner)
"enumerateObjectsUsingBlock:"           → "EnumerateObjectsUsing"
"count"                                 → "Count"

func PackageName

func PackageName(framework string) string

PackageName converts a framework name to a Go package name (lowercase).

func ProtocolGoTypeName

func ProtocolGoTypeName(protoName string, classNameOwner map[string]string) string

ProtocolGoTypeName returns the Go interface type name for an ObjC protocol, disambiguating from a class of the same name by appending "Protocol" (Apple's NSObject exists as both a class and a protocol; the class takes the bare name). classNameOwner maps class names → owning framework; when the protocol's bare Go name appears there the suffix is applied, otherwise the bare name is used.

Types

This section is empty.

Jump to

Keyboard shortcuts

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