setter-gen

command
v0.0.0-...-392fa8f Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

setter-gen is a tool for auto-generating set struct field functions.

Given a list of input directories, it will generate SetField methods. If these already exist (are predefined by the developer), they are used instead of generating new ones.

All generation is governed by comment tags in the source. Any package may request Getter generation by including a comment in the file-comments of a doc.go file, of the form:

// +gen:setter=package

Getter functions can be generated for individual types, rather than the entire package by specifying a comment on the type or filed definition of the form:

// +gen:setter=true|false

You can not participate in the generation by setting the field a comment on the type definition of the form:

type Struct struct {
	// +setter=false
	Field string
}

You can also specify the field name that needs to be generated a comment on the type definition of the form:

// +gen:setter:fields=field1,field2,field3

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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