Age | Commit message (Collapse) | Author |
|
Starting with Go 1.17, //go:build lines are preferred over // +build
lines, see https://golang.org/doc/go1.17#build-lines and
https://golang.org/design/draft-gobuild for details.
This change was generated by running Go 1.17 go fmt ./... which
automatically adds //go:build lines based on the existing // +build
lines.
Also update the corresponding GitHub action to use Go 1.17 gofmt.
|
|
There is no LICENSE.md file, but there is a LICENSE file.
|
|
A shallow copy with reflect.ValueOf(v.Interface()) does not work
if v is a nil interface value. Special case the edge case by
checking for a nil value and create a new one use reflect.Zero.
|
|
The current implementation for forcibly exporting fields relies on
the reflect.Value.Addr method for the parent struct value,
where it copies a non-addressable struct onto to the heap so
that it is addressable. However, this action leaks a subtle detail
of how the internal implementation works since the accessed field
for within a struct is only addressable if and only if the
parent struct is also addressable.
Modify the implementation to avoid leaking this implementation detail
by shallow copying the accessed unexported field to remove any
notion of addressability if the parent struct is also unaddressable.
Fixes #181
|
|
Add an Exporter option that accepts a function to determine
which struct types to permit access to unexported fields.
Treat this as a first-class option and implement AllowUnexported
in terms of the new Exporter option.
The new Exporter option:
* Better matches the existing style of top-level options
both by name (e.g., Comparer, Transformer, and Reporter)
and by API style (all accept a function).
* Is more flexible as it enables users to functionally
implement AllowAllUnexported by simply doing:
Exporter(func(reflect.Type) bool { return true })
Fixes #40
|
|
Fixes #167
|
|
Rename the file based on what it does rather than how its implemented.
|