file

package
v0.0.0-...-a810e79 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2021 License: Apache-2.0 Imports: 6 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(path string, snippet Snippet) error

Append a code snippet to a file.

func Reset

func Reset(path string, imports []string) 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 ...interface{})

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
}

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