write

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package writer provides a writer that allows converting a file.File to Go code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// IdentPrefix is the prefix corgi puts in front of an identifier.
	//
	// It defaults to "__corgi_".
	IdentPrefix string

	AllowedFilters  []string
	AllowAllFilters bool

	// CLI indicates that this writer is run by the corgi CLI and may reference
	// CLI options in error messages, and print to stderr on its own.
	CLI bool
	// CorgierrPretty are the [corgierr.PrettyOptions] used to print pretty
	// errors.
	//
	// Only used if CLI is true.
	CorgierrPretty corgierr.PrettyOptions

	// Debug, if set to true, attaches file and position information of scope
	// items to the generated file.
	Debug bool
}

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

func New

func New(o Options) *Writer

func (*Writer) GenerateFile

func (w *Writer) GenerateFile(out io.Writer, destPackage string, f *file.File) (err error)

func (*Writer) PrecompileLibrary

func (w *Writer) PrecompileLibrary(out io.Writer, lib *file.Library) (err error)

Jump to

Keyboard shortcuts

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