Help us shape the future of Go! Take the 2026 Go Developer Survey

args

package
v0.27.3 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Args

type Args struct {
	OutputDir  string // must be a directory path
	OutputPkg  string // must be a Go import-path
	OutputFile string

	GoHeaderFile string

	// ReportFilename is added to Args for specifying name of report file used
	// by API linter. If specified, API rule violations will be printed to report file.
	// Otherwise default value "-" will be used which indicates stdout.
	ReportFilename string

	// OutputModelNameFile is the name of the file to be generated for OpenAPI schema name
	// accessor functions. If empty, no model name accessor functions are generated.
	// When this is specified, the OpenAPI spec generator will use the function names
	// instead of Go type names for schema names.
	OutputModelNameFile string

	// ReadOnlyPkgs is a list of package paths that should be treated as
	// read-only. Model name files will not be generated for these packages.
	// This prevents the generator from attempting to write into read-only
	// dependency packages (e.g. in the Go module cache).
	ReadOnlyPkgs []string
}

func New

func New() *Args

New returns default arguments for the generator. Returning the arguments instead of using default flag parsing allows registering custom arguments afterwards

func (*Args) AddFlags

func (args *Args) AddFlags(fs *pflag.FlagSet)

AddFlags add the generator flags to the flag set.

func (*Args) Validate

func (args *Args) Validate() error

Validate checks the given arguments.

Jump to

Keyboard shortcuts

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