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