gen

package
v0.0.0-...-9d89862 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package gen provide tools for generate go files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultFormat

func DefaultFormat(in []byte) (out []byte, err error)

DefaultFormat default format source

func EmptyFormat

func EmptyFormat(in []byte) ([]byte, error)

EmptyFormat do not format

func OptionGoimportsFormtat

func OptionGoimportsFormtat(in []byte) ([]byte, error)

OptionGoimportsFormtat use the command line `goimports` command to format first. If an error is reported, use the default formatting method.

func SprintDoc

func SprintDoc(in string) (out string)

Types

type Generator

type Generator struct {
	Buf          bytes.Buffer // Accumulated output.
	FormatSource func(in []byte) (out []byte, err error)
}

Generator used to buffer the output for format.Source.

func (*Generator) Print

func (g *Generator) Print(args ...interface{})

func (*Generator) PrintDoc

func (g *Generator) PrintDoc(docs string)

func (*Generator) Printf

func (g *Generator) Printf(format string, args ...interface{})

func (*Generator) Println

func (g *Generator) Println(args ...interface{})

func (*Generator) Write

func (g *Generator) Write(file string) (err error)

Jump to

Keyboard shortcuts

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