All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Types of changes:
Securityin case of vulnerabilities.Removedfor now removed features.Deprecatedfor soon-to-be removed features.Addedfor new features.Changedfor changes in existing functionality.Fixedfor any bug fixes.Internalfor changes that are worth noting, but don't have any external effects.
This is not a breaking change from the prior version (0.7.1) but rather a solidification of the existing API and a commitment not to break it going forward. The API has been stable and is use for over 2 years, so this seems reasonable. If a breaking change is necessary in the future, it will require a major version bump.
--runtimecommand line flag - identifies the Go runtime version used to build the executable.- #5 Support anonymous function signatures as parameters.
- When passing multiple files as command line arguments, load packages once for the whole execution instead of once per file, resulting in a massive speedup when processing many files as loading packages is the slowest part of the process.
- Fixed
$.AddImportTypefailing on certain go types:- interface literals
- struct type literals
- maps
- functions signatures
- New template function,
catNoSpace, that concatenates multiple strings together into one with no separators between them. This complements the already includedcatfunction from Sprig http://masterminds.github.io/sprig/strings.html which joins with a space in between each string.
- New template function
isExportedthat detects if a name is private or exported.
- The template function
typeStringhas been moved to a context method$.TypeStringin order to prevent including the package in the type string if it is part of the current package.
- The current package is now always prevented from being imported into the
generated file, even if it is passed to
AddImport. - Fixed parsing of the "codegen" tags to be compatible with go 1.17.
- New template context method
$.AddImportTypewhich takes a type object instead of a string. - New template method
typeStringwhich returns the full go representation of the type, including '*' for pointers, '[]' for slices, etc.
typeNameno longer panics for basic types that don't have a package:int,string, etc.
-vcommand line flag that prints the version number and exits.
- A new template context method
$.RequireArgwhich returns the value of a template argument if it was provided, and fails the generation if the argument was not provided. - A new template context method
$.DefaultArgwhich returns the value of a template argument if it was provided, and a default value (second parameter passed toDefaultArg) if the template argument was not provided.
- The template method
typeNamenow correctly returns the name of pointer types (without the asterisk). - The template method
structFieldcan now return un-exported fields in addition to exported fields.
- A new template method
structFieldswhich returns an array of the fields (type[]*types.Var) declared on the passed struct. Note that this doesn't include fields elevated from embedded types.
- The template variable
.Structis now an instance of*types.Namedinstead of*types.Struct. This is necessary to inspect the methods on the struct as they are tied to the named type, not the underlying struct.
This is where we formally began tracking changes.