Skip to content

Setting: name

name NAME can be defined as CLI argument or conversion comment.

name instructs goverter to use the given name for the generated struct. By default goverter will use the interface name and append Impl at the end.

go
package example

// goverter:converter
// goverter:name RenamedConverter
type Converter interface {
	Convert(Input) Output
}

type Input struct {
	Name string
}
type Output struct {
	Name string
}
go
// Code generated by github.com/jmattheis/goverter, DO NOT EDIT.
//go:build !goverter

package generated

import namestruct "github.com/jmattheis/goverter/example/name-struct"

type RenamedConverter struct{}

func (c *RenamedConverter) Convert(source namestruct.Input) namestruct.Output {
	var exampleOutput namestruct.Output
	exampleOutput.Name = source.Name
	return exampleOutput
}