file

package
v0.0.0-...-a5439fb Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package file contains helpers to write auto-generated Go source files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Append

func Append(entity string, path string, snippet Snippet, iface bool) error

Append a code snippet to a file.

func Reset

func Reset(path string, imports []string, buildComment string, iface bool) error

Reset an auto-generated source file, writing a new empty file header.

Types

type Buffer

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

Buffer for accumulating source code output.

func (*Buffer) L

func (b *Buffer) L(format string, a ...any)

L accumulates a single line of source code.

func (*Buffer) N

func (b *Buffer) N()

N accumulates a single new line.

type Snippet

type Snippet interface {
	Generate(buffer *Buffer) error
	GenerateSignature(buffer *Buffer) error
}

Snippet generates a single code snippet of a target source file code.

Jump to

Keyboard shortcuts

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