v4.0.0-pre-3 #2103
Closed
hairyhenderson
started this conversation in
General
v4.0.0-pre-3
#2103
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
🥳 It's finally (almost) here! Welcome to gomplate v4.0.0-pre-3! This release is a (pre-release of a ) major
release, with breaking changes. Read on for more details...
Probably the most important feature that's evolved in gomplate over the years is
its support for reading and parsing data from a variety of sources. Using URLs
to specify where to find data has proven to be quite flexible, and has allowed
for a lot of different data sources to be supported.
In early 2021, I took what I had learned from supporting all of these different
data sources, and I created a new module called
go-fsimpl
, which provides anumber of Go filesystem implementations that can be used with Go's filesystem
interfaces.
My goal with
go-fsimpl
was always to use it in gomplate, and now that itsupports most of the data sources that gomplate supports, it's time to make the
switch! As a result, and because
go-fsimpl
presents a much more consistentand unified approach to data sources, I've had to drop support for one data
source, and in fixing some inconsistencies in how URLs have been handled by some
of the data sources, I've had to make some breaking changes there as well.
Please, if you're using gomplate in production, please read these release
notes carefully and in full, and review your usage of gomplate to make sure you
can adapt to these changes.
Breaking changes
Dropped support for the BoltDB data source
Support for the
boltdb
URL scheme has been removed. The implementation wasnever very robust, and I'm not aware of anyone using it. It had some unique
quirks that would have made it quite difficult to support in
go-fsiml
as-is,so I've decided to drop it.
No more
slim
binariesThe
slim
binaries were deprecated in v3.11, and will no longer be produced.Stricter URL handling
Subpaths are now always relative URLs
When using the
datasource
function with a subpath (second argument), thesubpath has previously been intepreted by some data sources as a simple addition
to the URL, and by others as a relative URL to be interpreted relative to the
data source's base URL (as specified by the
--datasource
flag).Now, all data sources will interpret the subpath as a relative URL, and will
resolve it relative to the data source's base URL. This means that, given a base
URL of
git+https://github.com/hairyhenderson/gomplate//random
and a subpath ofrandom.go
, the resulting URL will begit+https://github.com/hairyhenderson/gomplate//random.go
. To correct this,make sure that base URLs end with a trailing slash when the last component is a
directory.
Also, if the subpath begins with a slash, it will be interpreted as an absolute
path, and will replace the base URL's path. For example, given a base URL of
git+file:///tmp/repos//myrepo/
and a subpath of/myfile.txt
, the resultingURL will be
git+file:///myfile.txt
. To correct this, make sure that subpathsdon't begin with a slash. Note that for the special
//
separator indicatingthe separation between a Git repository and the path within, a subpath should
now begin with
.//
rather than//
.This affects at least the
git
andfile
data sources.Directories in datasource URLs must end with a slash
Previously, some data sources would assume URLs that end without a trailing
slash are directories, and relative lookups would be performed within that
directory. This was inconsistent with how URLs are normally interpreted, and
could lead to unexpected results.
Now, all data sources will always interpret URLs without a trailing slash as
files, and relative lookups will be performed within the parent directory of the
URL.
For example, given a base URL of
vault:///secret
and a subpath offoo
, theresulting URL will be
vault:///foo
. To correct this, make sure that base URLsend with a trailing slash when the last component is a directory.
Consistent data values
The
aws+smp
data source previously returned the AWS output object, withboth metadata and data. Users needed to reference the
Value
field to get theactual data. Now, the
aws+smp
data source will return the data directly.The
consul
data source supports directory semantics, but previously returnedall the data as a JSON array of key/value pair objects. Now, the
consul
datasource will return directory listings like all other data sources, as a JSON
array of strings (the names of the keys).
Vault app-id auth support removed
Support for the Vault app-id auth method has been removed. This method was
deprecated in Vault 0.6.1, and removed in Vault 1.13. If you're still using this
method, you must switch to a different auth method.
The
suppressEmpty
behaviour is now always enabledIn previous versions of gomplate, output that consist only of whitespace would
by default still be written to files, with the
suppressEmpty
flag orGOMPLATE_SUPPRESS_EMPTY
environment variable being required to suppress thisbehaviour. Now, this behaviour is always enabled, and the
suppressEmpty
flagand
GOMPLATE_SUPPRESS_EMPTY
environment variable have been removed.Log message formatting changes
A new logging framework is now in use (the standard library's
log/slog
package), and so error and debug (
--verbose
) messages will appear differently(different colours for the console format, and key/value pairs may are sorted
differently).
Removed functions
The following functions have been removed:
conv.Dict
,conv.Slice
,conv.Has
- These have been deprecated since v3.2.0and have been replaced with
coll.Dict
,coll.Slice
, andcoll.Has
.Deprecations
See
the deprecation policy.
slice
alias forcoll.Slice
(usecoll.Slice
instead)net.Parse*
functions which produced values from theinet.af/netaddr
module have been deprecated and replaced with functions using the Go standard
library's
net/netip
package:net.ParseIP
(usenet.ParseAddr
instead)net.ParseIPPrefix
(usenet.ParsePrefix
instead)net.ParseIPRange
(usenet.ParseRange
instead)based form is now available. This will be removed in a later v4 minor release
(i.e. not in v4.0.0, but before v5).
AWS_META_ENDPOINT
environment variable for overriding theIMDS endpoint in
aws
functions has been deprecated in favor of theAWS-native
AWS_EC2_METADATA_SERVICE_ENDPOINT
. This will be removed in alater v4 minor release (i.e. not in v4.0.0, but before v5).
like
staticcheck
will help you find these in your code if you're usinggomplate as a module. Follow the instructions in the deprecation comments to
find out what to use instead.
Thanks
Plenty of people have contributed to gomplate by filing issues, suggesting new
features, or submitting pull requests. I'd like to especially thank the
following people for submitting pull requests in this release:
Be sure to also check out the multi-platform Docker images available at
hairyhenderson/gomplate
.If you've gained value out of gomplate and want to find a way to encourage development, please consider sponsoring gomplate!
v4.0.0-pre-3 (2024-06-09)
Full Changelog (since v3.11)
Changes since v4.0.0-pre-2
Release Notes
New features and changes
funcs
package tointernal/funcs
--exclude-processing
optioncoll.Pick
now supports slice of strings as inputdata.Data
type with a datasource registrystrings.Indent
to error on bad inputRunTemplates
function and oldConfig
typeConfig
type and updatedRun
function and other API functionsNew functions
strings.SkipLines
functioncoll.GoSlice
and deprecateslice
aliasBug fixes
strings.Title
not lowercase acronyms - thanks to @zregvart!Documentation fixes/updates
index
supports nested keys - thanks to @isavcic!index
and.
coll.GoSlice
example (fixes #1517)Misc. internal contributions
t.Setenv
to set env vars in tests - thanks to @Juneezee!github.com/Masterminds/semver
github.com/Masterminds/semver/v3
- thanks to @wuhuizuo!This discussion was created from the release v4.0.0-pre-3.
Beta Was this translation helpful? Give feedback.
All reactions