Setting: annotate:unmapped
annotate:unmapped [yes,no] is a boolean setting and can be defined as CLI argument, conversion comment or method comment. This setting is inheritable.
When enabled, goverter adds a comment // FIELD: SETTING to the generated code for each struct field that isn't converted, naming the setting that caused the field to be unset:
// FIELD: ignorefor fields ignored viaignore// FIELD: ignoreMissingfor fields without a matching source field viaignoreMissing// FIELD: ignoreUnexportedfor unexported fields viaignoreUnexported
go
package example
// goverter:converter
// goverter:annotate:unmapped
type Converter interface {
// goverter:ignore Age
// goverter:ignoreMissing
// goverter:ignoreUnexported
Convert(source Input) Output
}
type Input struct {
Name string
}
type Output struct {
Name string
Age int
Missing string
unexported string
}go
// Code generated by github.com/jmattheis/goverter, DO NOT EDIT.
//go:build !goverter
package generated
import annotateunmapped "github.com/jmattheis/goverter/example/annotate-unmapped"
type ConverterImpl struct{}
func (c *ConverterImpl) Convert(source annotateunmapped.Input) annotateunmapped.Output {
var exampleOutput annotateunmapped.Output
exampleOutput.Name = source.Name
// exampleOutput.Age: ignore
// exampleOutput.Missing: ignoreMissing
// exampleOutput.unexported: ignoreUnexported
return exampleOutput
}