Skip to content

Setting: ignoreUnexported ‚Äč

ignoreUnexported [yes,no] is a boolean setting and can be defined as CLI argument, converter comment or method comment. This setting is inheritable.

If a struct has multiple unexported fields that should be ignored, then you can enable ignoreUnexported, to ignore these.


Using this setting is not recommended, because this can easily lead to unwanted behavior. When a struct is having unexported fields, you most likely have to call a custom constructor method to correctly instantiate this type.

package example

// goverter:converter
type Converter interface {
	// goverter:ignoreUnexported
	Convert(source Input) Output

type Input struct {
	Name string
type Output struct {
	Name string
	// goverter will skip this field
	age    int
	street string
// Code generated by, DO NOT EDIT.
//go:build !goverter

package generated

import ignoreunexported ""

type ConverterImpl struct{}

func (c *ConverterImpl) Convert(source ignoreunexported.Input) ignoreunexported.Output {
	var exampleOutput ignoreunexported.Output
	exampleOutput.Name = source.Name
	return exampleOutput