file

package
v0.0.0-...-433fd04 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const BuildComment = `//go:build linux && cgo && !agent
// +build linux,cgo,!agent

`

BuildComment includes the necessary comments for building. The extra new line at the end is required.

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
	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