runtimeextract

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package runtimeextract reads Go source files from the embedded runtime FS and extracts code bodies for inlining into generated output or assembling into standalone runtime packages.

Index

Constants

View Source
const RuntimeModulePrefix = "github.com/oapi-codegen/oapi-codegen-exp/codegen/internal/runtime/"

RuntimeModulePrefix is the import path prefix for the internal runtime sub-packages. Used by the extractor to strip internal imports when inlining, and by the runtime generator to rewrite them to the target base path.

Variables

This section is empty.

Functions

This section is empty.

Types

type Import

type Import struct {
	Path  string
	Alias string
}

Import represents a Go import with optional alias.

func ExtractAllInline

func ExtractAllInline(fsys fs.FS) (code string, imports []Import, err error)

ExtractAllInline reads ALL runtime .go files (types/*, params/*, helpers/*), strips package qualifiers for inlining (types.Date → Date, etc.), merges imports, and returns a single code body ready to be inserted into a generated file. Internal runtime import paths are removed from the import list.

The returned code is wrapped in marker comments so the DCE pass can identify which declarations are runtime candidates.

func ExtractPackage

func ExtractPackage(fsys fs.FS, dir string) (code string, imports []Import, err error)

ExtractPackage reads all .go files from a sub-directory of the given FS that contain an //oapi-runtime:function annotation and returns the concatenated code bodies and merged imports. No qualifier substitution is performed — the output is suitable for a standalone runtime package.

Jump to

Keyboard shortcuts

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