gonverge

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoFileConverger

type GoFileConverger struct {
	// MaxWorkers determines the maximum amount
	// of file workers that will be created to
	// process all files in the given directory.
	MaxWorkers int

	// Packages is a list of packages to include in the output.
	// If empty, converger will default to top-level NON-TEST
	// package in the given directory.
	Packages []string

	// Excludes is a list of files to exclude from merging.
	Excludes []string

	// Logger is the logger to use for logging.
	Logger logger.LevelLogger
}

GoFileConverger is a struct that converges multiple Go files into one.

func NewGoFileConverger

func NewGoFileConverger(opts ...Option) *GoFileConverger

NewGoFileConverger creates a new GoFileConverger with sensible defaults.

func (*GoFileConverger) ConvergeFiles

func (gfc *GoFileConverger) ConvergeFiles(ctx context.Context, src string, w io.Writer) error

ConvergeFiles converges all Go files in the given directory and package into one and writes the result to the given output.

type Option

type Option func(*GoFileConverger)

Option is a functional option for the GoFileConverger.

func WithExcludes

func WithExcludes(excludes []string) Option

WithExcludes sets the list of files to exclude from merging.

func WithLogger

func WithLogger(logger logger.LevelLogger) Option

WithLogger sets the logger for the GoFileConverger.

func WithMaxWorkers

func WithMaxWorkers(maxWorkers int) Option

WithMaxWorkers sets the maximum amount of workers to use.

func WithPackages

func WithPackages(packages []string) Option

WithPackages sets the list of packages to include in the output.

Jump to

Keyboard shortcuts

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