Skip to content

Changelog

unreleased

v1.5.1

v1.5.0

  • Add two input-output formats. See Guide: Input/Output formats for help to choose a format. The new formats allow you to call top level functions without the need to instantiate a struct to call methods on it. (#77 via #149)
  • Add line numbers of originating definitions to all error messages. (#149)

v1.4.1

  • Error when the settings enum and useUnderlyingTypeMethods conflict. (#141 via #142)
  • Add CLI commands help and version. (#144 via #145)
  • Improve generation by assigning variables directly if possible. (#97 via #148)
    Examples
    diff
     func (c *ConverterImpl) Convert(source execution.Input) execution.Output {
         var structsOutput execution.Output
    -    var pString *string
         if source.Nested.Name != nil {
             xstring := *source.Nested.Name
    -        pString = &xstring
    +        structsOutput.Name = &xstring
         }
    -    structsOutput.Name = pString
         return structsOutput
     }

    diff
     func (c *ConverterImpl) ConvertPToP(source []*int) []*int {
         var pIntList []*int
         if source != nil {
             pIntList = make([]*int, len(source))
             for i := 0; i < len(source); i++ {
    -            var pInt *int
                 if source[i] != nil {
                     xint := *source[i]
    -                pInt = &xint
    +                pIntList[i] = &xint
                 }
    -            pIntList[i] = pInt
             }
         }
         return pIntList
     }

v1.4.0

internals:

  • Require the examples to be up-to-date via CI (#136)
  • Fix file permissions in tests (#136)

v1.3.2

Change generated directory permissions from 777 -> 755 and generated file permissions from 777 -> 644. This only affects newly created files and directories. Existing files and directories will keep their current permissions. (#128 via #129)

v1.3.1

Fix nil map conversion. A nil map of will be converted to a nil map of the target type. Previously, the target map was instantiated via make with a 0 size. (#126 via #127)

v1.3.0

internals:

  • Migrate documentation to vitepress (#118)

v1.2.0

  • Support using unexported fields, methods and functions when they are accessible from the output:package (#104 via #107)
  • Fix ignored field settings for conversions from non pointer to pointer types (#104 via #107)
  • Improve error messages for *T to T conversions (#105 via #106)
  • Error on overlapping internal sub methods (#105 via #106)

internals:

  • Execute tests in parallel (#108)

v1.1.1

Fix a panic when using the error type inside the conversion.

(#102 via #103)

v1.1.0

v1.0.0

  • Major rework of documentation. See settings (#92)
  • Rework of the CLI (#92)
  • Improve handling of boolean flags, allow disabling these settings for single methods. See define (#92)
  • Add output:file output:pattern settings: output (#92)
  • Remove deprecated mapExtend mapIdentity: migrations (#92)
  • Refactor internals for upcoming features (#92)
  • Remove pkg/errors dependency (#92)
  • Improve error messages (#92)

See migrations for instructions to migrate to this version. If you have problems with this release please create a ticket in this project.

v0.18.0

Add skipCopySameType, this setting instruct Goverter to skip copying instances when the source and target type is the same.

(#86 via #87)

v0.17.5

Prevent unused variables in generated code when empty structs are used

(#82 via #83)

v0.17.4

Fix endless loop when converting nested recursive types.

(#73 via #74)

v0.17.3

Fix panic when generating a conversion method containing the type map[string]interface{}. (#71 via #72)

v0.17.2

Readd go1.16 support for building goverter, it broke with v0.17.1.

(#69 via #70)

v0.17.1

Fix generation of types with generic arguments (#66 via #67)

v0.17.0

v0.16.0

v0.15.0

v0.14.0

  • Prevent value copying of source struct pointers if possible. This should fix "go vet copylocks" warnings, because some structs should not be copied. See (#39 via #56)
  • Due to the change above, the generated code will look different, because goverter now splits internal converter methods differently. The overall behavior of the implementation shouldn't change. (#56)
  • Error on overlapping field mappings. This doesn't change how config is evaluated, but it does now error when field mapping config like goverter:map is at the wrong converter method and would be ignored. (#56)

v0.13.0

  • Fix docs links in error messages
  • Allow using external packages in map (#47 via #50)
  • Allow returning an error in map (#43 via #50)
  • Error on misconfiguration (#8 via #51)

v0.12.0

v0.11.1

Fix pointer slice conversion

(#40 via be3874)

v0.11.0

Allow passing self in mapExtend method

(#38 via eb1337)

v0.10.1

  • Improve error message on compile errors (#35)
  • Fix goverter:mapIdentity with pointer types (#36 via feeafb)

v0.10.0

By default, goverter will fail if you don't ignore all unexported fields. To automatically ignore all unexported fields, you can enable ignoreUnexported (#31 via #32)

v0.9.0

Add wrapErrors (#29)

v0.8.1

Use extend method when converter method with same method exists

(#26 via 12cc64)

v0.8.0

Add mapExtend FIELD METHOD (#25)

v0.7.0

Allow setting the packagePath of the generated converter to prevent import loops. (#22)

v0.6.3

  • Fix generation with generics (#20)
  • Exit with non-zero on error (#21)

v0.6.2

Fix compile errors in code generation with error in return type

v0.6.1

Error using extend on unexported method (#17)

v0.6.0

Add matchIgnoreCase (#16)

v0.5.0

Add working directory setting. (#15)

v0.4.0

v0.3.0

Add mapIdentity FIELD. (#12 via #13)

v0.2.0

  • Support nesting in map. (#3 via #5)
  • Fail on structs with unexported fields. (#5)

v0.1.2

Fix map & ignore for struct pointer

v0.1.1

Add tests

v0.1.0

Initial Release